PopupMenu sub menu alignment



Hello guys,

Just noticed that when opening a sub menu, it is either aligned on top with its parent item if the latter is in the top half of the screen, either aligned on bottom if the parent is in the bottom half of the screen.

Here is an example with the projucer:

Is there is any specific reason why it happens? This behavior looks weird to me…

The code in question is in juce_PopupMenu.cpp lines 670-671. Works as expected if I comment out those lines.

if (target.getCentreY() > parentArea.getCentreY())
    y = jmax (parentArea.getY(), target.getBottom() - heightToUse);