diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-06-05 13:50:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-05 13:50:35 +0200 |
commit | 4b8609ded937481275146342bdd9aea1326adad3 (patch) | |
tree | 7831cdd5f5d43164c6d8119cd1f18c154499e76c | |
parent | 0df0a07ab86381c1580a0a38d11ec44c4c9fddf7 (diff) | |
parent | bb07c6a7d07097719813904dab00f529201da5f6 (diff) |
Merge pull request #61690 from againey/zoom-fix-for-canvas-item-editor
Fix zoom in callback for CanvasItemEditor to use correct numeric sign
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index d28629b41a..d4d18ccb0c 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1284,8 +1284,8 @@ 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(-1, p_alt); - if (!Math::is_equal_approx(p_scroll_vec.y, (real_t)1.0)) { + zoom_widget->set_zoom_by_increments((int)SIGN(p_scroll_vec.y), 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)); } |