mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
MPEKeyboardComponent: Avoid asserting when clicking on highest visible key
This commit is contained in:
parent
c5b428dfe9
commit
34adc50472
1 changed files with 3 additions and 6 deletions
|
|
@ -387,14 +387,11 @@ void MPEKeyboardComponent::updateNoteComponentBounds (const MPENote& note, MPENo
|
|||
const auto currentNote = note.initialNote + (float) note.totalPitchbendInSemitones;
|
||||
const auto noteBend = currentNote - std::floor (currentNote);
|
||||
|
||||
const auto averageKeySize = (float) getTotalKeyboardWidth() / (float) (1 + getRangeEnd() - getRangeStart());
|
||||
const auto distance = noteBend * averageKeySize;
|
||||
|
||||
const auto noteBounds = getRectangleForKey ((int) currentNote);
|
||||
const auto nextNoteBounds = getRectangleForKey ((int) currentNote + 1);
|
||||
|
||||
const auto horizontal = isHorizontal();
|
||||
|
||||
const auto distance = noteBend * (horizontal ? nextNoteBounds.getCentreX() - noteBounds.getCentreX()
|
||||
: nextNoteBounds.getCentreY() - noteBounds.getCentreY());
|
||||
|
||||
return (horizontal ? noteBounds.getCentreX() : noteBounds.getCentreY()) + distance;
|
||||
}();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue