Overriding MidiKeyboardComponent::mouseDownOnKey() not working as expected


from mouseDownOnKey() documentation:

Return true if you want the click to trigger the note, or false if you
want to handle it yourself and not have the note played.

But if you override it and return false, the notes will still be played!
this is because a ‘mouse drag’ is called right after a mouse click, and that drag triggers the note (*)

In order to deal with that (and it probably also makes sense during common mouse drags), MidiKeyboardComponent::mouseDraggedToKey() should also return a bool to allow us to define if the note should be played or if we want to handle that ourself (just like it is for mouseDownOnKey())

diff.txt (2,1 Ko)

(*) the ‘mouse drag’ event sent after a mouse click is a known behaviour of juce on mac


Yep, that makes sense. I’ll get that added.