Skip to content

paint: Support pinch-zoom for factors less than 1.#43688

Open
shubhamg13 wants to merge 1 commit intoservo:mainfrom
shubhamg13:pinch_less_than_1
Open

paint: Support pinch-zoom for factors less than 1.#43688
shubhamg13 wants to merge 1 commit intoservo:mainfrom
shubhamg13:pinch_less_than_1

Conversation

@shubhamg13
Copy link
Copy Markdown
Member

Now it fully support pinch-zoom over whole range 0.1 to 10.0

Testing: Tested Manually on Mobile Device.

@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 26, 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(),
);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need a comment explaining why we don't want to clamp if the scale is less than 1.0.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure: will update later.

Comment on lines -85 to -89
if self.zoom_factor <= 1.0 {
self.transform = Transform2D::identity();
return;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thinking about proper way.

@servo-highfive servo-highfive added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-needs-code-changes Changes have not yet been made that were requested by a reviewer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants