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

Feature request: Zoom to Fit #7

Open
khonkhortisan opened this issue Jul 10, 2020 · 0 comments
Open

Feature request: Zoom to Fit #7

khonkhortisan opened this issue Jul 10, 2020 · 0 comments

Comments

@khonkhortisan
Copy link

Where it's zoomed in until just before it would create scrollbars.
word→word cards are giant, sentence cards are reasonably sized, image occlusion images fit on the screen, and cards that are too long are too small to read. This wouldn't go well with incremental reading long pages in the reviewer, unless there was a minimum zoom level.

PDFs have a defined size, so it's easy to fit-to-width, fit-to-height, or fit-to-container. HTML word-wraps when the zoom is increased, so even when the width appears to stay constant, increasing the zoom by a little bit when there's a lot of text increases the height by a lot, then zooming again by that new height can make it zoomed in less than when it started.
A solution should check whether scrollbars do exist or calculate whether they would, and may benefit from a bisect algorithm. Or there may be an option to tell webkit to do all the zooming itself.

js-only attempt:
var minsize=0.1; var padding=20; document.getElementsByClassName('card')[0].style.zoom=Math.max(minsize,(window.innerHeight-1)/(padding+document.getElementsByClassName('card')[0].scrollHeight+padding));
Running this multiple times mostly works, but on some cards scrollHeight returns a value lower than it actually is, and causes it to zoom in way too far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant