diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2020-09-22 22:54:36 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2020-09-22 22:54:36 +0300 |
commit | c2b55c4362111c124df30eb339461486bda32ec9 (patch) | |
tree | 841267dade995551e9d1ab8f39ab98c7a56174db /indra/llui/llaccordionctrltab.cpp | |
parent | e566e82269ff52a88e3dc28345bba6c273a2eebf (diff) | |
parent | 60ed688026269568a9eef67437dc780f88c92871 (diff) |
Merged master(DRTVWR-503) into DRTVWR-514-keymappings
Diffstat (limited to 'indra/llui/llaccordionctrltab.cpp')
-rw-r--r-- | indra/llui/llaccordionctrltab.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 1034a21905..098621b543 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -452,6 +452,35 @@ void LLAccordionCtrlTab::onVisibilityChange(BOOL new_visibility) notifyParent(LLSD().with("child_visibility_change", new_visibility)); } +// virtual +void LLAccordionCtrlTab::onUpdateScrollToChild(const LLUICtrl *cntrl) +{ + if (mScrollbar && mScrollbar->getVisible()) + { + LLRect rect; + cntrl->localRectToOtherView(cntrl->getLocalRect(), &rect, this); + + // Translate to parent coordinatess to check if we are in visible rectangle + rect.translate(getRect().mLeft, getRect().mBottom); + + if (!getRect().contains(rect)) + { + // for accordition's scroll, height is in pixels + // Back to local coords and calculate position for scroller + S32 bottom = mScrollbar->getDocPos() - rect.mBottom + getRect().mBottom; + S32 top = mScrollbar->getDocPos() - rect.mTop + getRect().mTop; + + S32 scroll_pos = llclamp(mScrollbar->getDocPos(), + bottom, // min vertical scroll + top); // max vertical scroll + + mScrollbar->setDocPos(scroll_pos); + } + } + + LLUICtrl::onUpdateScrollToChild(cntrl); +} + BOOL LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask) { if(mCollapsible && mHeaderVisible && mCanOpenClose) |