summaryrefslogtreecommitdiff
path: root/indra/llui/llaccordionctrl.cpp
diff options
context:
space:
mode:
authorDave Houlton <euclid@lindenlab.com>2020-09-22 23:24:00 +0000
committerDave Houlton <euclid@lindenlab.com>2020-09-22 23:24:00 +0000
commit987be6bdb4d6b554ee30692d6b4508640f132a0c (patch)
tree0d00fdcb12b4dfa5c9d5fb954188258285636f77 /indra/llui/llaccordionctrl.cpp
parentc2c5e672e25d3272db0b062c3831abded6db9141 (diff)
parent79b8c9de9be576f46f7471f726c6d8e3d91cc131 (diff)
Merged in DV510-merge-6.4.9 (pull request #313)
Merge master 6.4.9 into DRTVWR-510
Diffstat (limited to 'indra/llui/llaccordionctrl.cpp')
-rw-r--r--indra/llui/llaccordionctrl.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp
index edcbc3fbb7..61a119800e 100644
--- a/indra/llui/llaccordionctrl.cpp
+++ b/indra/llui/llaccordionctrl.cpp
@@ -655,6 +655,37 @@ void LLAccordionCtrl::onScrollPosChangeCallback(S32, LLScrollbar*)
{
updateLayout(getRect().getWidth(),getRect().getHeight());
}
+
+// virtual
+void LLAccordionCtrl::onUpdateScrollToChild(const LLUICtrl *cntrl)
+{
+ if (mScrollbar && mScrollbar->getVisible())
+ {
+ // same as scrollToShowRect
+ 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);
+}
+
void LLAccordionCtrl::onOpen (const LLSD& key)
{
for(size_t i=0;i<mAccordionTabs.size();++i)