mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
PopupMenu: Simplify expressions in ensureItemComponentIsVisible()
This commit is contained in:
parent
41a6ed37e4
commit
d2cb90cded
1 changed files with 6 additions and 8 deletions
|
|
@ -1105,19 +1105,17 @@ struct MenuWindow final : public Component
|
|||
windowPos.getHeight() - (PopupMenuSettings::scrollZone + itemComp.getHeight())),
|
||||
itemComp.getY());
|
||||
|
||||
auto parentArea = getParentArea (windowPos.getPosition(), options.getParentComponent()) / scaleFactor;
|
||||
auto deltaY = wantedY - itemComp.getY();
|
||||
const auto parentArea = getParentArea (windowPos.getPosition(), options.getParentComponent()) / scaleFactor;
|
||||
const auto deltaY = windowPos.getY() + wantedY - itemComp.getY();
|
||||
|
||||
windowPos.setSize (jmin (windowPos.getWidth(), parentArea.getWidth()),
|
||||
jmin (windowPos.getHeight(), parentArea.getHeight()));
|
||||
|
||||
auto newY = jlimit (parentArea.getY(),
|
||||
parentArea.getBottom() - windowPos.getHeight(),
|
||||
windowPos.getY() + deltaY);
|
||||
const auto newY = jlimit (parentArea.getY(),
|
||||
parentArea.getBottom() - windowPos.getHeight(),
|
||||
deltaY);
|
||||
|
||||
deltaY -= newY - windowPos.getY();
|
||||
|
||||
childYOffset -= deltaY;
|
||||
childYOffset -= (deltaY - newY);
|
||||
windowPos.setPosition (windowPos.getX(), newY);
|
||||
|
||||
updateYPositions();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue