Mouse Drag Events pushing Multiple Entries to the juce::UndoManager

Hi team,

We’ve noticed our plug-ins have multiple entries to the UndoManager class on a mouse wheel move event. This is due to the ScopedDragNotification being called on every mouse wheel move event within the implementation .cpp of juce::Slider. This is also prevalent on track pads or anything that simulates a mouseWheelMove. This means that our users are undoing one interaction with multiple undos.

A related post is:

mouseWheelMove begin & end? - JUCE

Is there a plan to fix this within the framework?

Thanks in advance

I’m not sure how you would implement a fix for this. After all, how do you know when a gesture like that begins and ends?

One “fix” I proposed for an internal undo stack we wrote before moving to Juce was to have a control ID and a timestamp included in the undo items. Then we could determine whether to simply push onto the stack (if the time elapsed since the last push was greater than some threshold, or if the last item was not for the same control), or pop the last item and then push the new one otherwise.

We never implemented that, though.

They are available callbacks on macOS, so our suggestion here would make those available: mouseWheelMove begin & end? - #6 by goodhertz

But not on Windows. And their responses in that chain didn’t sound too promising.