Skip to content

Fix(Whiteboard): Fixed onSizeChanged and implemented testcase#20617

Open
LUwUcifer wants to merge 1 commit intoankidroid:mainfrom
LUwUcifer:whiteboard-size-change-fix
Open

Fix(Whiteboard): Fixed onSizeChanged and implemented testcase#20617
LUwUcifer wants to merge 1 commit intoankidroid:mainfrom
LUwUcifer:whiteboard-size-change-fix

Conversation

@LUwUcifer
Copy link
Copy Markdown
Contributor

Purpose / Description

Issue as described in #20616

Fixes

Approach

Utilises matrix transform to correct the bitmap
https://developer.android.com/reference/android/graphics/Path#transform(android.graphics.Matrix)

How Has This Been Tested?

Tested on local device as well as emulator, testcase fails for old implementation

Learning (optional, can help others)

Requesting a thorough review of the test file as it has been implemented through a vague understanding of implementation from other repositories
AI Disclaimer: Github Copilot in github was used to search for other repositories testcases for research

Links to blog posts, patterns, libraries or addons used to solve this problem

Checklist

Please, go through these checks before submitting the PR.

  • 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
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@david-allison
Copy link
Copy Markdown
Member

@DoomsCoder
Copy link
Copy Markdown
Contributor

@LUwUcifer You might want to add the copyright header in the new file, similar to other files. It should fix the Lint check 👍

@LUwUcifer LUwUcifer force-pushed the whiteboard-size-change-fix branch from 415178e to 62b07ec Compare March 28, 2026 18:38
@LUwUcifer LUwUcifer force-pushed the whiteboard-size-change-fix branch from 62b07ec to 005872e Compare March 28, 2026 18:39
@LUwUcifer
Copy link
Copy Markdown
Contributor Author

@david-allison fine to check now

@david-allison
Copy link
Copy Markdown
Member

david-allison commented Mar 29, 2026

Please produce a before/after video.

It's been a while since Uni, I suspect the math is good, but a video provides much better confidence without a bit of revision.

@LUwUcifer
Copy link
Copy Markdown
Contributor Author

@david-allison
Copy link
Copy Markdown
Member

david-allison commented Mar 29, 2026

@BrayanDSO this doesn't look right to me, I'll defer to your judgment of a 'correct' implementation here

@LUwUcifer
Copy link
Copy Markdown
Contributor Author

LUwUcifer commented Mar 29, 2026

This was the implementation in the previous study screen in Whiteboard.kt as well, I agree the application does not look visually appealing and have made a feature suggestion post in the anki forum earlier
https://forums.ankiweb.net/t/feature-option-to-resize-whiteboard-bitmap-upon-size-change-in-general/69275

@BrayanDSO
Copy link
Copy Markdown
Member

That's a consequence of having a non-infinite drawing space that can vary.

Between moving stuff out of bounds and resizing (which also means changing) the user's drawing, I prefer the former, because it doesn't modify anything and the implementation is simpler.

@BrayanDSO BrayanDSO added Needs Author Reply Waiting for a reply from the original author and removed Needs Review labels Mar 29, 2026
@LUwUcifer
Copy link
Copy Markdown
Contributor Author

Change in Orientation on most devices will usually move half the drawing space out of bounds, I agree remapping in ratio is not the best option and would like to work towards a resizing feature as I suggested on the forum, lmk if you would like changes to this PR or if I should close it

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scaling Bitmaps don't work on New Study Screen Whiteboard

4 participants