diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp index 717e135412e2948cf3ad4ee376059da96dcc3e27..5df1d35383241739a64c8c5b8a278bc9d597d1ea 100644 --- a/indra/llui/lltoggleablemenu.cpp +++ b/indra/llui/lltoggleablemenu.cpp @@ -40,6 +40,7 @@ static LLDefaultChildRegistry::Register<LLToggleableMenu> r("toggleable_menu"); LLToggleableMenu::LLToggleableMenu(const LLToggleableMenu::Params& p) : LLMenuGL(p), + mButtonRect(), mClosedByButtonClick(false) { } @@ -56,13 +57,19 @@ void LLToggleableMenu::handleVisibilityChange (BOOL curVisibilityIn) } } -void LLToggleableMenu::setButtonRect(const LLRect& rect, LLView* current_view) +void LLToggleableMenu::setButtonRect(const LLRect& rect, LLView* current_view) { LLRect screen; current_view->localRectToScreen(rect, &screen); mButtonRect = screen; } +void LLToggleableMenu::setButtonRect(LLView* current_view) +{ + LLRect rect = current_view->getLocalRect(); + setButtonRect(rect, current_view); +} + bool LLToggleableMenu::toggleVisibility() { if (mClosedByButtonClick) diff --git a/indra/llui/lltoggleablemenu.h b/indra/llui/lltoggleablemenu.h index 3cd66e04a8bfec056eebfe7820d39e39fbe658be..9d8c5261b9ca4de5365b844f4d345937d0281303 100644 --- a/indra/llui/lltoggleablemenu.h +++ b/indra/llui/lltoggleablemenu.h @@ -49,8 +49,11 @@ class LLToggleableMenu : public LLMenuGL public: virtual void handleVisibilityChange (BOOL curVisibilityIn); + const LLRect& getButtonRect() const { return mButtonRect; } + // Converts the given local button rect to a screen rect void setButtonRect(const LLRect& rect, LLView* current_view); + void setButtonRect(LLView* current_view); // Returns "true" if menu was not closed by button click // and is not still visible. If menu is visible toggles diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 18135fc5587e51a762c6c2745e683bbda45d6157..01603f390def7cef46db24861b61bc4a9414e656 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -901,7 +901,10 @@ void LLFavoritesBarCtrl::showDropDownMenu() menu->buildDrawLabels(); menu->updateParent(LLMenuGL::sMenuContainer); - menu->setButtonRect(mChevronRect, this); + if (menu->getButtonRect().isEmpty()) + { + menu->setButtonRect(mChevronRect, this); + } LLMenuGL::showPopup(this, menu, getRect().getWidth() - menu->getRect().getWidth(), 0); return; diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index f0aa189b7f4b3e5952734c6a97994434aafb62d7..2254684f2150c9ae3bb7090739df9f13e961240e 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -570,10 +570,14 @@ void LLPanelAvatarProfile::onOverflowButtonClicked() return; LLView* btn = getChild<LLView>("overflow_btn"); - LLRect rect = btn->getRect(); + if (mProfileMenu->getButtonRect().isEmpty()) + { + mProfileMenu->setButtonRect(btn); + } mProfileMenu->updateParent(LLMenuGL::sMenuContainer); - mProfileMenu->setButtonRect(btn->getLocalRect(), btn); + + LLRect rect = btn->getRect(); LLMenuGL::showPopup(this, mProfileMenu, rect.mRight, rect.mTop); } diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 6905c7e546fe61ec9ffac2c768dcf9c55598a23a..04b4226f82f8dd7bde746d338ae79fd06ff022ec 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -346,11 +346,18 @@ void LLPanelPicks::onAccordionStateChanged(const LLAccordionCtrlTab* acc_tab) void LLPanelPicks::onOverflowButtonClicked() { - LLRect rect; - childGetRect(XML_BTN_OVERFLOW, rect); + if (!mOverflowMenu->toggleVisibility()) + return; + + LLView* btn = getChild<LLView>(XML_BTN_OVERFLOW); + if (mOverflowMenu->getButtonRect().isEmpty()) + { + mOverflowMenu->setButtonRect(btn); + } mOverflowMenu->updateParent(LLMenuGL::sMenuContainer); - mOverflowMenu->setButtonRect(rect, this); + + LLRect rect = btn->getRect(); LLMenuGL::showPopup(this, mOverflowMenu, rect.mRight, rect.mTop); } diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 3d0fba9426a71b925148becf93ba32ae9751783b..eb10d97b371ef11eaf2d6e56d0cf12e15fccd576 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -601,9 +601,12 @@ void LLPanelPlaces::onOverflowButtonClicked() if (!menu->toggleVisibility()) return; + if (menu->getButtonRect().isEmpty()) + { + menu->setButtonRect(mOverflowBtn); + } menu->updateParent(LLMenuGL::sMenuContainer); LLRect rect = mOverflowBtn->getRect(); - menu->setButtonRect(rect, this); LLMenuGL::showPopup(this, menu, rect.mRight, rect.mTop); }