[gtk/gtk-3-24: 2/3] demo: Use pinch translation in the gestures demo
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 2/3] demo: Use pinch translation in the gestures demo
- Date: Fri, 17 Jan 2020 22:25:29 +0000 (UTC)
commit 1c050bdcf4dbd75b8de8940d2af5fd1038b3bab9
Author: Yariv Barkan <nushoin users noreply github com>
Date: Sat Dec 14 11:27:44 2019 +0200
demo: Use pinch translation in the gestures demo
Add the pinch translation offset to the pinch gesture demo. That allows
moving the square around in addition to the already-supported rotate and
zoom.
demos/gtk-demo/gestures.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/demos/gtk-demo/gestures.c b/demos/gtk-demo/gestures.c
index 1e88a9ec91..9632e7d665 100644
--- a/demos/gtk-demo/gestures.c
+++ b/demos/gtk-demo/gestures.c
@@ -96,11 +96,12 @@ drawing_area_draw (GtkWidget *widget,
cairo_pattern_t *pat;
cairo_matrix_t matrix;
gdouble angle, scale;
+ gdouble x_center, y_center;
+
+ gtk_gesture_get_bounding_box_center (GTK_GESTURE (zoom), &x_center, &y_center);
cairo_get_matrix (cr, &matrix);
- cairo_matrix_translate (&matrix,
- allocation.width / 2,
- allocation.height / 2);
+ cairo_matrix_translate (&matrix, x_center, y_center);
cairo_save (cr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]