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

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

Open
4 tasks done
aaaaaad333 opened this issue Jan 16, 2024 · 12 comments
Open
4 tasks done
Assignees
Labels
Bug Good First Issue! Help Wanted Requesting Pull Requests from volunteers image-occlusion
Milestone

Comments

@aaaaaad333
Copy link

aaaaaad333 commented Jan 16, 2024

Checked for duplicates?

  • This issue is not a duplicate

What are the steps to reproduce this bug?

Create an Image Occlusion card in Anki desktop (Version ⁨23.12.1).
Sync and review it in AnkiDroid.

Expected behaviour

Images fit to width.

Actual behaviour

Images are very small and have to be zoomed in manually.

This is a card made with Anki's native Image Occlusion:

test1

This was made using the Image Occlusion Enhanced addon:

test2

Debug info

AnkiDroid Version = 2.17alpha15 (e5b25f3fef737140ae396d1b212a8d638551500f)

Backend Version = 0.1.34-anki23.12.1 (23.12.1 1a1d4d5419c6b57ef3baf99c9d2d9cf85d36ae0a)

Android Version = 12 (SDK 31)

ProductFlavor = full

Manufacturer = HMD Global

Model = Nokia 5.4

Hardware = qcom

Webview User Agent = Mozilla/5.0 (Linux; Android 12; Nokia 5.4 Build/SKQ1.220119.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/120.0.6099.193 Mobile Safari/537.36

ACRA UUID = e3cee8ce-3afa-4813-a03d-d23e62bc8a76

Crash Reports Enabled = false

(Optional) Anything else you want to share?

Update: the issue is still present in AnkiDroid 2.17alpha16

Research

  • I am reporting a bug specific to AnkiDroid (Android app)
  • I have checked the manual and the FAQ and could not find a solution to my issue
  • (Optional) I have confirmed the issue is not resolved in the latest alpha release (instructions)
Copy link

welcome bot commented Jan 16, 2024

Hello! 👋 Thanks for logging this issue. Please remember we are all volunteers here, so some patience may be required before we can get to the issue. Also remember that the fastest way to get resolution on an issue is to propose a change directly, https://github.com/ankidroid/Anki-Android/wiki/Contributing

@aaaaaad333
Copy link
Author

For anyone having this issue, changing the styling template to this works. It's a hacky solution but it does the job:

#image-occlusion-canvas {
    --inactive-shape-color: #ffeba2;
    --active-shape-color: #ff8e8e;
    --inactive-shape-border: 1px #212121;
    --active-shape-border: 1px #212121;

    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: auto;
    object-fit: contain;
}

.card {
    font-family: arial;
    font-size: 20px;
    text-align: center;
    color: black;
    background-color: white;
}

#image-occlusion-container img {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: auto;
    object-fit: contain;
}

@user1823

This comment was marked as outdated.

@user1823
Copy link
Contributor

user1823 commented Feb 6, 2024

Here is what Damien has to say on this issue:

The styling for each client will be different, so I think this should be styled by each client separately instead of done in the core code. AnkiMobile already injects its own styling so that the image appears correctly for it.

@david-allison david-allison added Help Wanted Requesting Pull Requests from volunteers Good First Issue! and removed Needs Triage labels Feb 7, 2024
@david-allison
Copy link
Member

Here is what Damien has to say on this issue:

The styling for each client will be different, so I think this should be styled by each client separately instead of done in the core code. AnkiMobile already injects its own styling so that the image appears correctly for it.

Thanks! Good first issue to apply the CSS provided above

@dennisko762
Copy link

Hey, Im currently also looking into this and for some reason Im either unable to reproduce it or to stupid. Maybe you can help me out.
Details: Im using the 2.17alpha16 on a samsung galaxy s20.
For me the images are fit nicely to the screen.

@user1823
Copy link
Contributor

To reproduce this, the phone needs to be in the landscape mode. Probably, you are trying to reproduce it in the Portrait mode.

@david-allison david-allison changed the title [BUG]: Images in Image Occlusion cards are too small on AnkiDroid [BUG]: Images in Image Occlusion cards are too small on AnkiDroid [landscape mode] Feb 10, 2024
@dennisko762
Copy link

Screenshot_20240210-142135_AnkiDroid

So this one is in landscape mode. Id say is rather big than too small. Or does the problem only occur with the native occlusion?

@user1823
Copy link
Contributor

user1823 commented Feb 10, 2024

Or does the problem only occur with the native occlusion?

Yes. As mentioned in the original post, it occurs only with the native IO cards.

Id say is rather big than too small.

Probably, we should find a middle way between the current size in native IO cards and the size in add-on generated IO cards.

@QuiteChridi
Copy link

Hi, I was starting to look into this issue and was able to reproduce it. I tried adding the afore mentioned css styling to the "flashcard.css" file to fix it, but unfortunately it does not seem to solve the problem, it just shifts the image to the left without changing the size.

Am I missing something obvious here about the place where the android specific styling should happen?

@RedLexa
Copy link

RedLexa commented Mar 7, 2024

I'm looking into this as my first issue! I've already replicated it think I have an idea of things to try on Anki Android to fix this issue, seen as tough it only seems to happen to me with certain image sizes. Could I have this assigned to me?

@RedLexa
Copy link

RedLexa commented Mar 18, 2024

Hello! I'd like to give some updates regarding this issue, seen as though I've already fixed the main bug but am now facing another which I'm struggling to consider how to fix.

The CSS provided earlier in this thread works! But only if you !important the #image-occlusion-container img properties. However, a downside I wasn't expecting was that the occlusion itself now seems to be deformed.
FIxed com Occlusion estragadad
The div containing the Occlusion doesn't have any id so I was not sure how to proceed.
<div style="display: none">{{cloze:Occlusion}}</div>
Should I add an id to that div, so that I can style it along with other #image-occlusion-container img class, ensuring it stays in place?

RedLexa pushed a commit to RedLexa/Anki-Android that referenced this issue Mar 25, 2024
RedLexa pushed a commit to RedLexa/Anki-Android that referenced this issue Mar 25, 2024
Applied suggested styling, with !important to make sure it was applied over the ones imported over from the Desktop app.
@mikehardy mikehardy modified the milestones: 2.17.6 release, 2.18 release Apr 3, 2024
RedLexa added a commit to RedLexa/Anki-Android that referenced this issue Apr 4, 2024
Applied suggested styling, with !important to make sure it was applied over the ones imported over from the Desktop app.
@mikehardy mikehardy removed this from the 2.18 release milestone May 13, 2024
@mikehardy mikehardy added this to the 2.19 release milestone May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Good First Issue! Help Wanted Requesting Pull Requests from volunteers image-occlusion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants