paint: Support pinch-zoom for factors less than 1.#43688
Open
shubhamg13 wants to merge 1 commit intoservo:mainfrom
Open
paint: Support pinch-zoom for factors less than 1.#43688shubhamg13 wants to merge 1 commit intoservo:mainfrom
shubhamg13 wants to merge 1 commit intoservo:mainfrom
Conversation
Signed-off-by: Shubham Gupta <[email protected]>
mrobinson
requested changes
Mar 27, 2026
Comment on lines
+69
to
+77
| if scale > 1.0 { | ||
| rect.origin = rect.origin.clamp( | ||
| Point2D::origin(), | ||
| (self.unscaled_viewport_size - rect.size) | ||
| .to_vector() | ||
| .to_point(), | ||
| ); | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
This will need a comment explaining why we don't want to clamp if the scale is less than 1.0.
Member
Author
There was a problem hiding this comment.
Sure: will update later.
Comment on lines
-85
to
-89
| if self.zoom_factor <= 1.0 { | ||
| self.transform = Transform2D::identity(); | ||
| return; | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
I don't think we want to unconditionally allow scaling less than 1.0. This should be allowed only in some cases by the viewport, metatag, right? You obviously cannot pinch zoom to a scale less than 1.0 in desktop browsers.
Member
Author
There was a problem hiding this comment.
Yeah, thinking about proper way.
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.
Now it fully support pinch-zoom over whole range 0.1 to 10.0
Testing: Tested Manually on Mobile Device.