Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX]: Image occlusion cards created on desktop app now fit to width #16109

Closed
wants to merge 4 commits into from

Conversation

RedLexa
Copy link

@RedLexa RedLexa commented Apr 5, 2024

Purpose / Description

This commit applies the suggested solution in #15235, ensuring Image Occlusion cards created in the desktop app fit to width.

Fixes

Approach

Applying the correct styling with !important to make sure it overwrites whatver came over from the Desktop app that was causing issues.

How Has This Been Tested?

I ran this with multiple image sizes, creating them in the desktop app and then opening then in AnkiDroid while in landscape mode.

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code

RedLexa and others added 2 commits April 4, 2024 13:14
Applied suggested styling, with !important to make sure it was applied over the ones imported over from the Desktop app.
Copy link

welcome bot commented Apr 5, 2024

First PR! 🚀 We sincerely appreciate that you have taken the time to propose a change to AnkiDroid! Please have patience with us as we are all volunteers - we will get to this as soon as possible.

@david-allison
Copy link
Member

david-allison commented Apr 5, 2024

Thanks! Could you provide before/after screenshots in portrait and landscape?

Did you also resolve: #15235 (comment)

@david-allison david-allison added Needs Author Reply Waiting for a reply from the original author squash-merge The pull request currently requires maintainers to "Squash Merge" labels Apr 5, 2024
@RedLexa
Copy link
Author

RedLexa commented Apr 5, 2024

Thanks! Could you provide before/after screenshots in portrait and landscape?

Did you also resolve: #15235 (comment)

I did resolve #15235 (comment) ! I wasn't putting !important on the right properties, that fixed it.
As for the screenshots, here they are:
BEFORE
Hacksaw RIdge normal
Hacksaw RIdge em Landscape
AFTER
Hacksaw final  Landscape
Hacksaw final normal

@david-allison
Copy link
Member

david-allison commented Apr 5, 2024

And to confirm, that's the intended outcome (as all the text isn't occluded)

@RedLexa
Copy link
Author

RedLexa commented Apr 5, 2024

And to confirm, that's the intended outcome (as all the text isn't occluded)

Yes! That was just a placeholder occlusion I placed to test if it was working.
(You aren't to first to point out how slightly annoying it is that the occlusion just barely covers all the text, I'll try to do better next time :) )

Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic, thanks so much for doing the deep dive and seeing this through!

@david-allison david-allison added Needs Second Approval Has one approval, one more approval to merge and removed Needs Author Reply Waiting for a reply from the original author labels Apr 5, 2024
Comment on lines +138 to +141
--inactive-shape-color: #ffeba2;
--active-shape-color: #ff8e8e;
--inactive-shape-border: 1px #212121;
--active-shape-border: 1px #212121;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the relation of these colors with the occlusions size? Are they necessary? If so, why?

Copy link
Member

@krmanik krmanik Apr 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need these changes, these are available in notetype of image occlusion.
https://github.com/ankitects/anki/blob/main/rslib/src/image_occlusion/notetype.css

@krmanik
Copy link
Member

krmanik commented Apr 6, 2024

The backside of card hides toggle button,

@BrayanDSO BrayanDSO added the Needs Author Reply Waiting for a reply from the original author label Apr 26, 2024
@RedLexa RedLexa closed this Apr 28, 2024
@RedLexa RedLexa reopened this Apr 28, 2024
@RedLexa
Copy link
Author

RedLexa commented Apr 28, 2024

Hey everyone. Sorry for the late reply, school got in the way. I'm afraid I have some bad news: the new UI for the card reviewing seems to have messed with something that was making the solution work beforehand. ( #16109 (comment)) Now, the issue seems to be back:

image

However, through my testing, even cards Image Occlusion cards seem created directly on AnkiDroid seem to be having this issue. I'm stumped on what to do here. What changes that were implemented in the last 3 weeks that might mess with the card css? Thank you all again for your patience and sorry for the delay.

@david-allison
Copy link
Member

@RedLexa are you testing on main? We recently applied a fix for some JS errors in the Reviewer

@RedLexa
Copy link
Author

RedLexa commented Apr 28, 2024

@david-allison I'm testing on the branch image-occlusion-fix from my fork. I'm not sure why it's even updated at this point? Must have been one of the accidental fork syncs I did.

@david-allison
Copy link
Member

You need to manually rebase it onto the current main

@BrayanDSO
Copy link
Member

FWIW, this is the CSS that I stole retrieved from inspecting AnkiMobile:

#image-occlusion-container {
    position: relative;
    margin: 0 auto;
    max-height: calc(100vw - 24px) // this was `100vw - var(--io-header)`, which defaults to 24px but can change I think. I don't think that we want to implement something similar
}

#image-occlusion-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: unset;
    max-height: unset
}

@RedLexa
Copy link
Author

RedLexa commented Apr 28, 2024

Testing after having rebased had the same result, unfortunately.

@BrayanDSO Where did you get this styling? Was it from inspecting the image occlusion card's styling? The styling I'm applying should overwrite this and fix it, for some reason it isn't.

Copy link
Contributor

Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label May 12, 2024
@github-actions github-actions bot closed this May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Author Reply Waiting for a reply from the original author Needs Second Approval Has one approval, one more approval to merge New contributor squash-merge The pull request currently requires maintainers to "Squash Merge" Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: Images in Image Occlusion cards are too small on AnkiDroid [landscape mode]
4 participants