diff options
author | Seth ProductEngine <slitovchuk@productengine.com> | 2011-11-22 19:36:00 +0200 |
---|---|---|
committer | Seth ProductEngine <slitovchuk@productengine.com> | 2011-11-22 19:36:00 +0200 |
commit | d3773b991a22e2f13b37bc50fafb4477b5b940b1 (patch) | |
tree | 60457df04e78fde6ccb26b8c750d8cfd317a110a /indra/newview/lltoast.cpp | |
parent | 8448f9d727a5cb4d6c9610684e1001fee8982ce2 (diff) |
EXP-1506 FIXED starting the toast fade timer when a toast is overlapped by other floater like avatar inspector.
This is a kind of a workaround: perhaps the logic of updating the toast fade timer should be refactored to start/stop the timer from onMouseLeave/onMouseEnter callbacks instead of using "IsHovered" flag for each toast.
Diffstat (limited to 'indra/newview/lltoast.cpp')
-rw-r--r-- | indra/newview/lltoast.cpp | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index e0b07ed408..2d9d3241d8 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -419,25 +419,22 @@ void LLToast::onToastMouseLeave() S32 x, y; LLUI::getMousePositionScreen(&x, &y); - if( !panel_rc.pointInRect(x, y) && !button_rc.pointInRect(x, y)) - { - mOnToastHoverSignal(this, MOUSE_LEAVE); + mOnToastHoverSignal(this, MOUSE_LEAVE); - updateTransparency(); + updateTransparency(); - //toasts fading is management by Screen Channel + //toasts fading is management by Screen Channel - if(mHideBtn && mHideBtn->getEnabled()) + if(mHideBtn && mHideBtn->getEnabled()) + { + if( mHideBtnPressed ) { - if( mHideBtnPressed ) - { - mHideBtnPressed = false; - return; - } - mHideBtn->setVisible(FALSE); + mHideBtnPressed = false; + return; } - mToastMouseLeaveSignal(this, getValue()); + mHideBtn->setVisible(FALSE); } + mToastMouseLeaveSignal(this, getValue()); } void LLToast::setBackgroundOpaque(BOOL b) @@ -499,7 +496,31 @@ bool LLToast::isHovered() { S32 x, y; LLUI::getMousePositionScreen(&x, &y); - return mWrapperPanel->calcScreenRect().pointInRect(x, y); + + if (!mWrapperPanel->calcScreenRect().pointInRect(x, y)) + { + // mouse is not over this toast + return false; + } + + bool is_overlapped_by_other_floater = false; + + const child_list_t* child_list = gFloaterView->getChildList(); + + // find this toast in gFloaterView child list to check whether any floater + // with higher Z-order is visible under the mouse pointer overlapping this toast + child_list_const_reverse_iter_t r_iter = std::find(child_list->rbegin(), child_list->rend(), this); + if (r_iter != child_list->rend()) + { + // skip this toast and proceed to views above in Z-order + for (++r_iter; r_iter != child_list->rend(); ++r_iter) + { + LLView* view = *r_iter; + is_overlapped_by_other_floater = view->isInVisibleChain() && view->calcScreenRect().pointInRect(x, y); + if (is_overlapped_by_other_floater) break; + } + } + return !is_overlapped_by_other_floater; } //-------------------------------------------------------------------------- |