mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
Merge pull request #2340 from Areloch/popupMenuBGFix
Makes the popups correctly operate anywhere in the space of the canvas
This commit is contained in:
commit
e7c485b113
1 changed files with 149 additions and 146 deletions
|
|
@ -282,11 +282,6 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */)
|
||||||
if (owner == NULL)
|
if (owner == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GuiControl* editorGui;
|
|
||||||
Sim::findObject("EditorGui", editorGui);
|
|
||||||
|
|
||||||
if (editorGui)
|
|
||||||
{
|
|
||||||
GuiPopupMenuBackgroundCtrl* backgroundCtrl;
|
GuiPopupMenuBackgroundCtrl* backgroundCtrl;
|
||||||
Sim::findObject("PopUpMenuControl", backgroundCtrl);
|
Sim::findObject("PopUpMenuControl", backgroundCtrl);
|
||||||
|
|
||||||
|
|
@ -340,7 +335,7 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */)
|
||||||
if(backgroundCtrl->mMenuBarCtrl == nullptr)
|
if(backgroundCtrl->mMenuBarCtrl == nullptr)
|
||||||
backgroundCtrl->mMenuBarCtrl = getMenuBarCtrl();
|
backgroundCtrl->mMenuBarCtrl = getMenuBarCtrl();
|
||||||
|
|
||||||
backgroundCtrl->setExtent(editorGui->getExtent());
|
backgroundCtrl->setExtent(owner->getExtent());
|
||||||
|
|
||||||
mTextList->clear();
|
mTextList->clear();
|
||||||
|
|
||||||
|
|
@ -430,8 +425,16 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */)
|
||||||
mTextList->setPosition(popupPos.x - widthDiff, popupPos.y);
|
mTextList->setPosition(popupPos.x - widthDiff, popupPos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
mTextList->setHidden(false);
|
//If we'd overshoot the screen vertically, just mirror the axis so we're above the mouse
|
||||||
|
S32 heightDiff = (mTextList->getPosition().y + mTextList->getExtent().y) - backgroundCtrl->getHeight();
|
||||||
|
if (heightDiff > 0)
|
||||||
|
{
|
||||||
|
Point2I popupPos = mTextList->getPosition();
|
||||||
|
mTextList->setPosition(popupPos.x, popupPos.y - mTextList->getExtent().y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mTextList->setHidden(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupMenu::hidePopup()
|
void PopupMenu::hidePopup()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue