Closed earboxer closed 2 years ago
Hi @earboxer, this is a nice thing.
I don't have a touch display on my elderly laptop, so I can't really help, unfortunately :(
I suppose we'd need to get the two touch positions and calculate a scale and translate which mapped the two image points to those positions. Imagewindow
does this for single points for drag, so it'd be a two point version of that.
The drag code uses these:
/* Last known mouse postion, in gtk coordinates. We keep these in gtk
* cods so we don't need to update them on pan / zoom.
*/
double last_x_gtk;
double last_y_gtk;
/* For drag, the window position where we started, in gtk coordinates.
*/
int drag_start_x;
int drag_start_y;
Looking at GtkGestureZoom
you'd think it should emit drag signals for this, strange.
... but perhaps we should merge this and improve pinch zoom in another PR.
I figured it out. Since GtkGestureZoom extends GtkGesture, we can get a bunch of info about it, in this case, the center of the gesture when it started.
This is ready to be merged now!
Nice!
... I added a line to the CHANGELOG for this, and credited you. I hope that's OK.
Merging it sounds fine, though maybe we should add a todo comment?
Either way, I'm fine.
Good idea, I added a note.
Closes #6
Currently, this zooms from the center of the display (rather than from the center of the pinch/expand).
(It might be worth looking into how eog does this, since they seem to implement it correctly).