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.
This commit is contained in:
Povilas Kanapickas 2022-04-07 00:15:19 +03:00 committed by Jehan
parent ae3c4c3577
commit 40743c90a2
1 changed files with 3 additions and 3 deletions

View File

@ -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;