summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorAndy Gainey <7810015+againey@users.noreply.github.com>2022-06-05 16:23:41 +0200
committerAndy Gainey <7810015+againey@users.noreply.github.com>2022-06-05 16:29:59 +0200
commit9172ab37bf79e831efd12dd5cf81e3700629e849 (patch)
treea3e6ed931d4ae86f8be2d7f02307dc9adfbec0b6 /editor
parent25908c17c9a8665f81e5f55e0853212036f05b77 (diff)
Fix inverted mouse wheel zoom in CanvasItemEditor #61716
Bug introduced in bb07c6a7d0 while fixing symmetry of zooming in and out.
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index d4d18ccb0c..4377eff322 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -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) {
- 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)) {
// Handle high-precision (analog) scrolling.
zoom_widget->set_zoom(zoom * ((zoom_widget->get_zoom() / zoom - 1.f) * p_scroll_vec.y + 1.f));