BR: MidiKeyboardComponent leaves notes highlighted when moving mouse out of component slowly

MidiKeyboardComponent leaves notes highlighted when moving mouse out of window slowly.

int MidiKeyboardComponent::xyToNote (Point<float> pos, float& mousePositionVelocity)
{
    if (! reallyContains (pos.toInt(), false))
        return -1;

Assume pos = {0,-0.1} that means the mouse is outside the component. However when it gets cast to int it will be {0,0} which is inside the window. So when the mouse exits the note under the mouse never gets cleared.

bool Component::reallyContains (Point<int> point, bool returnTrueIfWithinAChild)
{
    return reallyContainsInternal (point.toFloat(), returnTrueIfWithinAChild);
}

reallyContains just casts the point back to a float and then calls reallyContainsInternal. If I could have access to reallyContainsInternal then then I wouldn’t need to go float → int → float and this wouldn’t be a bug.

Please make float versions of contains and reallyContains.

Thanks for the bug report and feature suggestion.

Float-based overloads added here:

Highlighting bug fixed here:

1 Like