Repository navigation
fix(android): report zoom in onScaleChanged so resizing the view isn't reported as a scale change - #1050
Open
GCyganek wants to merge 1 commit into
Open
fix(android): report zoom in onScaleChanged so resizing the view isn't reported as a scale change#1050GCyganek wants to merge 1 commit into
GCyganek wants to merge 1 commit into
Conversation
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.
Summary
Fixes #1049
On Android,
onScaleChangedreported the drawn page width divided by the page width of the first draw. When the view is resized (e.g. on device rotation), AndroidPdfViewer fits the page to the new view size, so the page width changes and the resize was reported as a zoom change:~2after rotating from portrait to landscape and~0.5the other way, without the user zooming.Change
Report the viewer's zoom in
onLayerDrawn(PdfView.java)scaleChanged|+getZoom()instead ofpageWidth / originalWidthoriginalWidth,lastPageWidthandlastPageHeightfieldsgetZoom()is relative to the page size fitted to the current view size, so resizing the view doesn't change it. This matches iOS, which reportsscaleFactor / _fixScaleFactor, recalculates_fixScaleFactoron every resize and only emits the event when the value changes.Downstream, this was found in Expensify: Expensify/App#103207
Verification
I opened an Expensify PR with the same changes as a patch