Repository navigation
fix(chat): keep a zoomed photo on screen when the finger lifts - #1751
Merged
Merged
Conversation
The viewer goes black after a pinch, or after any drag while zoomed. The event that lifts the last finger has no pointer still down, so calculateCentroid() returns Offset.Unspecified (NaN, NaN). The zoomed branch passed it to ChatMediaZoomState.transform, which made the offset NaN; clampOffset keeps NaN, and the graphicsLayer translation moved the photo out of view. A double tap brought it back because zooming out resets the offset to zero. transform now ignores an unspecified focus. ChatMediaZoomTest covers the lift event: it failed with a NaN offset before the change. A single tap on the photo now hides or shows the close and share buttons. They fade over 200ms (instantly with reduced motion) and stop taking taps as soon as they are hidden. Because the tap detector also handles double taps, a single tap waits out the double-tap timeout before toggling.
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.
The chat photo viewer goes black after a pinch, or after any drag while zoomed.
The event that lifts the last finger has no pointer still down, so
calculateCentroid()returnsOffset.Unspecified(NaN, NaN). The zoomed branch of the viewer's gesture loop passed it toChatMediaZoomState.transform, which made the offset NaN.clampOffsetkeeps NaN, so thegraphicsLayertranslation moved the photo out of view. A double tap brought it back because zooming out resets the offset to zero.transformnow ignores an unspecified focus.ChatMediaZoomTest.transformIgnoresTheLiftEventsMissingCentroidcovers the lift event and failed with a NaN offset before the change.A single tap on the photo now hides or shows the close and share buttons. They fade over 200ms (instantly with reduced motion) and stop taking taps as soon as they are hidden;
ChatPhotoMediaUiTest.singleTapTogglesTheButtonscovers the toggle. Because the same tap detector handles double-tap zoom, a single tap waits out the double-tap timeout before the buttons change.