Skip to content

Make camera controls more sensitive to trackpad pinch #7348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vincentwoo
Copy link
Contributor

@vincentwoo vincentwoo commented Feb 13, 2025

On browsers unfortunately trackpad pinch-zoom is sent over as a wheel event. However, the magnitude of these events are decidedly smaller in practice, leading to very unsatisfying pinch zooming. Multiplying deltas by 10 when they are less than 25 in my testing is an effective fix for this.

A more complete solution can be implemented by tracking the state of the ctrl key vs whether it was pressed beforehand in a separate keydown handler, but it is more onerous and this seems to work alright in the interim.

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

On browsers unfortunately trackpad pinch-zoom is sent over as a wheel event. However, the magnitude of these events are decidedly smaller in practice, leading to very unsatisfying pinch zooming. Multiplying deltas by 10 when they are less than 25 in my testing is an effective fix for this.
@Maksims
Copy link
Collaborator

Maksims commented Feb 13, 2025

I would be very hesitant to add such magical behaviour as people use different scroll speeds based on their OS's, and magical number of 25 and then 10 - might be unconsistent across various devices.
Especially considering it will change behavior for existing projects.

What would be a better solution, is to detect what kind of input it is from the event, to differentiate between mouse/touch/touchpad, and then do a decision based on that. It requires a various testing across different platforms and devices.
And perhaps for now you can do that decision on application level, instead of engine level.

@vincentwoo
Copy link
Contributor Author

Yeah I think that is perfectly reasonable, but I also think this hack is quite easy to delete when you build the input differentiation system. Up to you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants