mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
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.
This commit is contained in:
parent
00a488a5b5
commit
1a9b1f38a4
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user