mouseWheelMove begin & end?


#1

Is there any way to get begin/end for mouse wheel gestures?

We’re having a hard time coalescing gestures with mouse wheels where isSmooth == true for things like undo/redo. Currently, we just get a ton of mouseWheelMove callbacks for each gesture, which adds a lot of unnecessary points to our undo stack.


#2

I think that’s not something that exists. You could implement it yourself, but how long should you wait before deciding it’s the end of a gesture?


#3

yeah, it’s certainly not something that’s possible on all platforms. It may be available on OSX if you’re using a trackpad, but if we added support for that, then I’m not sure how it could emulate the callbacks on other platforms.


#4

Yeah, that makes sense. It’s definitely available on OS X because that’s how we previously handled mouse wheel support.

Would it be possible to implement begin/end where it’s available and just wrap all mouseWheelMove calls in begin/end calls where it’s not? Folks who don’t care about begin/end could just not override them, but we could significantly improve the Mac trackpad UX if we had it.


#5

Hmm - adding virtual methods to all the mouse listeners is a really non-trivial task. Will ponder it, but TBH since most platforms won’t support this, and the fallback would (I guess…) involve just a timer so that it sends an end message a couple of hundred ms after the last scroll event, you might as well just implement that yourself in the meantime.


#6

Gotcha. I think the fallback could be dumber than the timer approach though. You could just literally replace all mouseWheelMove calls with this:

mouseWheelBegin();
mouseWheelMove();
mouseWheelEnd();

For most mice, the above^ is accurate because they really have no concept of a gesture and are meant to be handled as discrete events. Would that make the task any easier?