From 35b08ecec2e4e493cf5154f7ee579fb52c659175 Mon Sep 17 00:00:00 2001 From: hogliux Date: Sun, 2 Jul 2017 20:22:04 +0100 Subject: [PATCH] Fixed an issue where submenus would not be scaled according to the transform used for the parent menu --- modules/juce_gui_basics/menus/juce_PopupMenu.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp index 291f4b7be7..0331658806 100644 --- a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp +++ b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp @@ -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);