diff --git a/libgimpwidgets/gimpwidgetsenums.h b/libgimpwidgets/gimpwidgetsenums.h index 3544afc6a3..ef6d935607 100644 --- a/libgimpwidgets/gimpwidgetsenums.h +++ b/libgimpwidgets/gimpwidgetsenums.h @@ -216,6 +216,7 @@ typedef enum * @GIMP_ZOOM_OUT_MAX: zoom out as far as possible * @GIMP_ZOOM_TO: zoom to a specific zoom factor * @GIMP_ZOOM_SMOOTH: zoom smoothly from a smooth scroll event + * @GIMP_ZOOM_PINCH: zoom smoothly from a touchpad pinch gesture * * the zoom types for #GimpZoomModel. **/ @@ -232,7 +233,8 @@ typedef enum GIMP_ZOOM_IN_MAX, /*< skip >*/ GIMP_ZOOM_OUT_MAX, /*< skip >*/ GIMP_ZOOM_TO, /*< skip >*/ - GIMP_ZOOM_SMOOTH /*< skip >*/ + GIMP_ZOOM_SMOOTH, /*< skip >*/ + GIMP_ZOOM_PINCH, /*< skip >*/ } GimpZoomType; diff --git a/libgimpwidgets/gimpzoommodel.c b/libgimpwidgets/gimpzoommodel.c index 6d12aba7c0..e4b772eacc 100644 --- a/libgimpwidgets/gimpzoommodel.c +++ b/libgimpwidgets/gimpzoommodel.c @@ -705,6 +705,14 @@ gimp_zoom_model_zoom_step (GimpZoomType zoom_type, new_scale = scale; break; + case GIMP_ZOOM_PINCH: + if (delta > 0.0) + new_scale = scale * (1.0 + delta); + else if (delta < 0.0) + new_scale = scale / (1.0 + -delta); + else + new_scale = scale; + break; } return CLAMP (new_scale, ZOOM_MIN, ZOOM_MAX);