On Tuesday, October 12, 2021 at 3:13:23 PM UTC-7 Albrecht Schlosser wrote:
On 10/12/21 7:13 PM Rob McDonald wrote:
> https://github.com/ramcdona/fltk/tree/MacOS_Gestures
Yep, found it. The only "real" issue is in draw(): you're pushing the
matrix at the wrong place in the code. You need to move
'fl_push_matrix();' up before 'fl_translate(...);' and it should work
... with some minor issues. Cute!
That would have taken me a long time to figure out -- drawing the first time works, but I suppose it quickly out-runs the stack depth of 4 and stops working... Thanks much for the tip - makes perfect sense.
What I saw so far: the rotation is "inverted". I'm leaving this one up
to you (unless this was intended).
No, and the 'scroll' to pan was also inverted.
Since it wasn't working, I wasn't able to test out the sign convention -- so no surprise they were wrong.
FLTK's fl_rotate() is positive CCW whereas FL_ROTATE_GESTURE is positive CW. The sign flip is expected.
The handling of FL_SCROLL_GESTURE had a negative inherited from the FL_MOUSEWHEEL code -- since it seemed quite counterintuitive for this use, I removed it there.
There was also one problem with event delivery (missing FL_ZOOM_GESTURE
in Fl_Group::handle(). I added it and now it works - at least as I'd expect.
Thanks
I've updated my branch with all these fixes together. It makes for a little 2D app that responds in all the ways I would want it to -- rotate, pan, zoom.
It looks like MacOS and Windows both also support a swype gesture -- I hadn't looked into it because I don't see a use in my application. However, as long as we're at it, we should probably be complete.
Rob