Browse Source

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

tags/2021-05-28
hogliux 8 years ago
parent
commit
35b08ecec2
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      modules/juce_gui_basics/menus/juce_PopupMenu.cpp

+ 4
- 4
modules/juce_gui_basics/menus/juce_PopupMenu.cpp 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);


Loading…
Cancel
Save