A little suggestion for better mouse double click behaviour

At the moment Component’s mouseDoubleClick() method seems to never be called if between the last 2 “mouseDown and mouseUp”-pairs the cursor has changed its position. that was probably done to prevent mouseDoubleClick() from being triggered by a drag.

But there can be different reasons for cursor position changes to appear than just drags. For example i made my knobs to become invisible on mouseDown() and to reveal themselves again on mouseUp() to let them have unbounded drags in between. Furthermore they reposition themselves on mouseUp() to the center of the component so that they don’t end up at the bounds of the screen. But that means that if i double click on them they must have moved at least once!

I tried putting the repositioning of the cursor into mouseDown instead of mouseUp hoping that would make it seem like there was no “drag”. That didn’t work and additionally also messed with the value of the knob before even started dragging, so i’ll have to put that back into mouseUp.

I think it would be cool if mouseDoubleClick() was just generally triggered on doubleClicks regardless of these “fake drags” and then we can check if mouseWasDragged in the method itself if needed. A solution to that specific to parameter types, like juce::Slider would be to let mouseDoubleClick be triggered by a change in value rather than the persistence of the cursor position.

Perhaps this doesn’t solve your problem but a small suggestion: I would set the cursor invisible in the mouseDrag() function. So it disappear only if the user is dragging. In my opinion this looks a little bit better and not so nervous.


doesn’t solve this problem specifically, but thx for the suggestion. that’s very useful as well

update: i was suggested to only return the cursor position in mouseUp if a drag occured. that solved my problem. i’d still say double click could be useful despite drag maybe but for now problem solved! :slight_smile: