Conversation
The zoom out button stops at 25% because that is the lowest entry in ZOOM_PRESETS, while pinch to zoom and the custom zoom dialog go down to MIN_ZOOM_RATIO (20%). Keep the presets as they are and let previousZoomPreset fall back to MIN_ZOOM_RATIO once no preset is left below the current zoom. Zooming out now goes 50% -> 25% -> 20% and the button disables at the minimum. Two tests cover it: one that the button reaches the minimum and then disables, and one that 50% still steps to 25% instead of skipping straight to the minimum. Fixes GrapheneOS#711
munzzyy
force-pushed
the
fix/zoom-min
branch
from
September 21, 2026 17:55
ba0b6aa to
b705f62
Compare
Author
|
Reworked as discussed in #721: the presets stay as they were and zoom out falls back to the minimum once no preset is left, so it goes 50% to 25% to 20%. I added a test that 50% still steps to 25%. It fails against my first version, which is the case @xhon-pelushi caught. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #711.
The zoom out button clamps at 25% because ZOOM_PRESETS starts at 25, while pinch to zoom and the custom zoom dialog both go down to MIN_ZOOM_RATIO (20%). This keeps the presets as they are and has previousZoomPreset fall back to MIN_ZOOM_RATIO once no preset is left below the current zoom. Zooming out goes 50% to 25% to 20% and the button disables at the minimum.
The first version of this PR replaced the 25 preset with the minimum. @xhon-pelushi pointed out in #721 that this drops the 25% step. That was right, so this now takes the same fallback shape as #721.
Two tests sit next to the existing min/max button tests. zoomOutButton_reachesMinZoom sets zoom to 25%, clicks zoom out, and asserts the ratio lands on MIN_ZOOM_RATIO and the button disables there. It fails on main, where the button is already disabled at 25%. zoomOutButton_stopsAtLowestPreset sets zoom to 50%, clicks zoom out, and asserts it lands on 25% with zoom out still enabled. It fails against the first version of this PR, which jumped from 50% to 20%.
Ran PdfViewerNavigationTest, PdfViewerMenuStateTest and PdfViewerRenderTest on an API 36 x86_64 emulator, 43 tests passing.