diff options
author | Yariv Barkan <nushoin@users.noreply.github.com> | 2019-12-14 11:27:44 +0200 |
---|---|---|
committer | Yariv Barkan <21448-yarivb@users.noreply.gitlab.gnome.org> | 2020-01-17 22:34:48 +0200 |
commit | 1a9b1f38a4c8ebcc025bb4cc2583aecbf62b67fc (patch) | |
tree | 5de964a7739e49b6a56d46f80a0affa796f61d0c | |
parent | 00a488a5b5d3bb8a9c5c755bba4152b190861a08 (diff) | |
download | gtk+-1a9b1f38a4c8ebcc025bb4cc2583aecbf62b67fc.tar.gz |
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.
-rw-r--r-- | demos/gtk-demo/gestures.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/demos/gtk-demo/gestures.c b/demos/gtk-demo/gestures.c index 8d53ae3434..4079ed950f 100644 --- a/demos/gtk-demo/gestures.c +++ b/demos/gtk-demo/gestures.c @@ -94,9 +94,12 @@ drawing_area_draw (GtkDrawingArea *area, 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, width / 2, height / 2); + cairo_matrix_translate (&matrix, x_center, y_center); cairo_save (cr); |