You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Fix inverted mouse wheel zoom in CanvasItemEditor #61716
Bug introduced in bb07c6a7d0 while fixing symmetry of zooming in and out.
This commit is contained in:
@@ -1284,7 +1284,9 @@ void CanvasItemEditor::_pan_callback(Vector2 p_scroll_vec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CanvasItemEditor::_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt) {
|
void CanvasItemEditor::_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt) {
|
||||||
zoom_widget->set_zoom_by_increments((int)SIGN(p_scroll_vec.y), p_alt);
|
int scroll_sign = (int)SIGN(p_scroll_vec.y);
|
||||||
|
// Inverted so that scrolling up (-1) zooms in, scrolling down (+1) zooms out.
|
||||||
|
zoom_widget->set_zoom_by_increments(-scroll_sign, p_alt);
|
||||||
if (!Math::is_equal_approx(ABS(p_scroll_vec.y), (real_t)1.0)) {
|
if (!Math::is_equal_approx(ABS(p_scroll_vec.y), (real_t)1.0)) {
|
||||||
// Handle high-precision (analog) scrolling.
|
// Handle high-precision (analog) scrolling.
|
||||||
zoom_widget->set_zoom(zoom * ((zoom_widget->get_zoom() / zoom - 1.f) * p_scroll_vec.y + 1.f));
|
zoom_widget->set_zoom(zoom * ((zoom_widget->get_zoom() / zoom - 1.f) * p_scroll_vec.y + 1.f));
|
||||||
|
|||||||
Reference in New Issue
Block a user