-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Add MagnifyGesture to Advanced Import dialog zooming #92235
Add MagnifyGesture to Advanced Import dialog zooming #92235
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks ok; I'm not too fond of magical constants, though, especially in UI.
Can you get the factor to be 0, triggering a divide by 0?
We have the same constants for the MouseButton Scrolling (just above my changes): Ref<InputEventMouseButton> mb = p_input;
if (mb.is_valid() && mb->get_button_index() == MouseButton::WHEEL_DOWN) {
(*zoom) *= 1.1;
if ((*zoom) > 10.0) {
(*zoom) = 10.0;
}
_update_camera();
}
if (mb.is_valid() && mb->get_button_index() == MouseButton::WHEEL_UP) {
(*zoom) /= 1.1;
if ((*zoom) < 0.1) {
(*zoom) = 0.1;
}
_update_camera();
}
No. I have tested it myself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would feel safer about this if there is either documentation proving it won't be 0, or some check to prevent division by 0.
other than that, @fire 's comment sounds like an approval, and I think it seems good.
@bruvzg Could you give your insight into this if |
It should not happen with real events. But nothing in the event code prevents it from being zero (you can create an event with zero factor from a script and feed it to the |
8ece453
to
d96ce7e
Compare
d96ce7e
to
f1b3f17
Compare
Check is implemented and PR rebased. |
Thanks! |
This adds the ability for Macbooks and other devices that use the magnifying gesture to zoom in the advanced import dialog.
Showcase
Bildschirmaufnahme.2024-05-22.um.04.18.43.mov