mirror of https://github.com/GNOME/gimp.git
libgimpwidgets: Introduce GIMP_ZOOM_PINCH
This zoom mode is handled pretty much the same as GIMP_ZOOM_SMOOTH except that we do not apply adjustments for the scaling delta. Pinch zooming is ultimately a different physical activity than smooth scrolling and users likely expect different sensitivity.
This commit is contained in:
parent
877d585271
commit
51d1ab9bce
|
@ -216,6 +216,7 @@ typedef enum
|
||||||
* @GIMP_ZOOM_OUT_MAX: zoom out as far as possible
|
* @GIMP_ZOOM_OUT_MAX: zoom out as far as possible
|
||||||
* @GIMP_ZOOM_TO: zoom to a specific zoom factor
|
* @GIMP_ZOOM_TO: zoom to a specific zoom factor
|
||||||
* @GIMP_ZOOM_SMOOTH: zoom smoothly from a smooth scroll event
|
* @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.
|
* the zoom types for #GimpZoomModel.
|
||||||
**/
|
**/
|
||||||
|
@ -232,7 +233,8 @@ typedef enum
|
||||||
GIMP_ZOOM_IN_MAX, /*< skip >*/
|
GIMP_ZOOM_IN_MAX, /*< skip >*/
|
||||||
GIMP_ZOOM_OUT_MAX, /*< skip >*/
|
GIMP_ZOOM_OUT_MAX, /*< skip >*/
|
||||||
GIMP_ZOOM_TO, /*< skip >*/
|
GIMP_ZOOM_TO, /*< skip >*/
|
||||||
GIMP_ZOOM_SMOOTH /*< skip >*/
|
GIMP_ZOOM_SMOOTH, /*< skip >*/
|
||||||
|
GIMP_ZOOM_PINCH, /*< skip >*/
|
||||||
} GimpZoomType;
|
} GimpZoomType;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -705,6 +705,14 @@ gimp_zoom_model_zoom_step (GimpZoomType zoom_type,
|
||||||
new_scale = scale;
|
new_scale = scale;
|
||||||
break;
|
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);
|
return CLAMP (new_scale, ZOOM_MIN, ZOOM_MAX);
|
||||||
|
|
Loading…
Reference in New Issue