[gimp] widgets: Fix out of bounds zoom in gradient editor



commit 40743c90a2cd6ab3b1f1a2b3b7fe5c1aae829e7a
Author: Povilas Kanapickas <povilas radix lt>
Date:   Thu Apr 7 00:15:19 2022 +0300

    widgets: Fix out of bounds zoom in gradient editor
    
    When zooming using scroll events it is possible to zoom out of gradient
    bounds because the check for out of bounds zoom happens with the zoom
    value before the delta is applied. The correct way is to limit the zoom
    value after the delta is applied.

 app/widgets/gimpgradienteditor.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/app/widgets/gimpgradienteditor.c b/app/widgets/gimpgradienteditor.c
index c721dd834e..d40b67a91c 100644
--- a/app/widgets/gimpgradienteditor.c
+++ b/app/widgets/gimpgradienteditor.c
@@ -723,11 +723,11 @@ gimp_gradient_editor_zoom (GimpGradientEditor *editor,
 
     case GIMP_ZOOM_OUT_MORE:
     case GIMP_ZOOM_OUT:
-      if (editor->zoom_factor <= 1)
-        return;
-
       editor->zoom_factor -= delta;
 
+      if (editor->zoom_factor < 1)
+        editor->zoom_factor = 1;
+
       page_size = 1.0 / editor->zoom_factor;
       value     = old_value - (page_size - old_page_size) * zoom_focus_x;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]