1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-18 00:54:19 +00:00

Fixed an issue where submenus would not be scaled according to the transform used for the parent menu

This commit is contained in:
hogliux 2017-07-02 20:22:04 +01:00
parent f4622f2f46
commit 35b08ecec2

View file

@ -193,7 +193,7 @@ class MenuWindow : public Component
public:
MenuWindow (const PopupMenu& menu, MenuWindow* parentWindow,
const Options& opts, bool alignToRectangle, bool shouldDismissOnMouseUp,
ApplicationCommandManager** manager)
ApplicationCommandManager** manager, float parentScaleFactor = 1.0f)
: Component ("menu"),
parent (parentWindow),
options (opts),
@ -203,7 +203,7 @@ public:
windowCreationTime (Time::getMillisecondCounter()),
lastFocusedTime (windowCreationTime),
timeEnteredCurrentChildComp (windowCreationTime),
scaleFactor (1.0f)
scaleFactor (parentWindow != nullptr ? parentScaleFactor : 1.0f)
{
setWantsKeyboardFocus (false);
setMouseClickGrabsKeyboardFocus (false);
@ -216,7 +216,7 @@ public:
parentComponent = lf.getParentComponentForMenuOptions (options);
if (parentComponent == nullptr && lf.shouldPopupMenuScaleWithTargetComponent (options))
if (parentComponent == nullptr && parentWindow == nullptr && lf.shouldPopupMenuScaleWithTargetComponent (options))
scaleFactor = getApproximateScaleFactorForTargetComponent (options.getTargetComponent());
setOpaque (lf.findColour (PopupMenu::backgroundColourId).isOpaque()
@ -899,7 +899,7 @@ public:
options.withTargetScreenArea (childComp->getScreenBounds())
.withMinimumWidth (0)
.withTargetComponent (nullptr),
false, dismissOnMouseUp, managerOfChosenCommand);
false, dismissOnMouseUp, managerOfChosenCommand, scaleFactor);
activeSubMenu->setVisible (true); // (must be called before enterModalState on Windows to avoid DropShadower confusion)
activeSubMenu->enterModalState (false);