summaryrefslogtreecommitdiff
path: root/indra/llui/llscrollcontainer.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2017-10-11 09:13:55 -0400
committerOz Linden <oz@lindenlab.com>2017-10-11 09:13:55 -0400
commitd62ad1ef8afc1b9abadbc611d373a7a7d9afc368 (patch)
tree9f14b141e692c3b78eee846f12fc021feacf1de6 /indra/llui/llscrollcontainer.cpp
parentc0ac11e24022eb51918e825414f2c04f3085bc61 (diff)
parentb6d22de58850fc9a5b34eeb5b7930e5845bfc42d (diff)
merge changes for 5.0.8-release
Diffstat (limited to 'indra/llui/llscrollcontainer.cpp')
-rw-r--r--indra/llui/llscrollcontainer.cpp50
1 files changed, 40 insertions, 10 deletions
diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index f70eebc594..6135cc56ad 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -72,6 +72,7 @@ LLScrollContainer::Params::Params()
hide_scrollbar("hide_scrollbar"),
min_auto_scroll_rate("min_auto_scroll_rate", 100),
max_auto_scroll_rate("max_auto_scroll_rate", 1000),
+ max_auto_scroll_zone("max_auto_scroll_zone", 16),
reserve_scroll_corner("reserve_scroll_corner", false),
size("size", -1)
{}
@@ -88,6 +89,7 @@ LLScrollContainer::LLScrollContainer(const LLScrollContainer::Params& p)
mReserveScrollCorner(p.reserve_scroll_corner),
mMinAutoScrollRate(p.min_auto_scroll_rate),
mMaxAutoScrollRate(p.max_auto_scroll_rate),
+ mMaxAutoScrollZone(p.max_auto_scroll_zone),
mScrolledView(NULL),
mSize(p.size)
{
@@ -290,8 +292,22 @@ BOOL LLScrollContainer::handleDragAndDrop(S32 x, S32 y, MASK mask,
return TRUE;
}
+bool LLScrollContainer::canAutoScroll(S32 x, S32 y)
+{
+ if (mAutoScrolling)
+ {
+ return true; // already scrolling
+ }
+ return autoScroll(x, y, false);
+}
+
bool LLScrollContainer::autoScroll(S32 x, S32 y)
{
+ return autoScroll(x, y, true);
+}
+
+bool LLScrollContainer::autoScroll(S32 x, S32 y, bool do_scroll)
+{
static LLUICachedControl<S32> scrollbar_size_control ("UIScrollbarSize", 0);
S32 scrollbar_size = (mSize == -1 ? scrollbar_size_control : mSize);
@@ -302,6 +318,8 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y)
screenRectToLocal(getRootView()->getLocalRect(), &screen_local_extents);
LLRect inner_rect_local( 0, mInnerRect.getHeight(), mInnerRect.getWidth(), 0 );
+ // Note: Will also include scrollers as scroll zones, so opposite
+ // scroll zones might have different size due to visible scrollers
if( mScrollbar[HORIZONTAL]->getVisible() )
{
inner_rect_local.mBottom += scrollbar_size;
@@ -316,8 +334,8 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y)
S32 auto_scroll_speed = ll_round(mAutoScrollRate * LLFrameTimer::getFrameDeltaTimeF32());
// autoscroll region should take up no more than one third of visible scroller area
- S32 auto_scroll_region_width = llmin(inner_rect_local.getWidth() / 3, 10);
- S32 auto_scroll_region_height = llmin(inner_rect_local.getHeight() / 3, 10);
+ S32 auto_scroll_region_width = llmin(inner_rect_local.getWidth() / 3, (S32)mMaxAutoScrollZone);
+ S32 auto_scroll_region_height = llmin(inner_rect_local.getHeight() / 3, (S32)mMaxAutoScrollZone);
if( mScrollbar[HORIZONTAL]->getVisible() )
{
@@ -325,8 +343,11 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y)
left_scroll_rect.mRight = inner_rect_local.mLeft + auto_scroll_region_width;
if( left_scroll_rect.pointInRect( x, y ) && (mScrollbar[HORIZONTAL]->getDocPos() > 0) )
{
- mScrollbar[HORIZONTAL]->setDocPos( mScrollbar[HORIZONTAL]->getDocPos() - auto_scroll_speed );
- mAutoScrolling = TRUE;
+ if (do_scroll)
+ {
+ mScrollbar[HORIZONTAL]->setDocPos(mScrollbar[HORIZONTAL]->getDocPos() - auto_scroll_speed);
+ mAutoScrolling = TRUE;
+ }
scrolling = true;
}
@@ -334,8 +355,11 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y)
right_scroll_rect.mLeft = inner_rect_local.mRight - auto_scroll_region_width;
if( right_scroll_rect.pointInRect( x, y ) && (mScrollbar[HORIZONTAL]->getDocPos() < mScrollbar[HORIZONTAL]->getDocPosMax()) )
{
- mScrollbar[HORIZONTAL]->setDocPos( mScrollbar[HORIZONTAL]->getDocPos() + auto_scroll_speed );
- mAutoScrolling = TRUE;
+ if (do_scroll)
+ {
+ mScrollbar[HORIZONTAL]->setDocPos(mScrollbar[HORIZONTAL]->getDocPos() + auto_scroll_speed);
+ mAutoScrolling = TRUE;
+ }
scrolling = true;
}
}
@@ -345,8 +369,11 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y)
bottom_scroll_rect.mTop = inner_rect_local.mBottom + auto_scroll_region_height;
if( bottom_scroll_rect.pointInRect( x, y ) && (mScrollbar[VERTICAL]->getDocPos() < mScrollbar[VERTICAL]->getDocPosMax()) )
{
- mScrollbar[VERTICAL]->setDocPos( mScrollbar[VERTICAL]->getDocPos() + auto_scroll_speed );
- mAutoScrolling = TRUE;
+ if (do_scroll)
+ {
+ mScrollbar[VERTICAL]->setDocPos(mScrollbar[VERTICAL]->getDocPos() + auto_scroll_speed);
+ mAutoScrolling = TRUE;
+ }
scrolling = true;
}
@@ -354,8 +381,11 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y)
top_scroll_rect.mBottom = inner_rect_local.mTop - auto_scroll_region_height;
if( top_scroll_rect.pointInRect( x, y ) && (mScrollbar[VERTICAL]->getDocPos() > 0) )
{
- mScrollbar[VERTICAL]->setDocPos( mScrollbar[VERTICAL]->getDocPos() - auto_scroll_speed );
- mAutoScrolling = TRUE;
+ if (do_scroll)
+ {
+ mScrollbar[VERTICAL]->setDocPos(mScrollbar[VERTICAL]->getDocPos() - auto_scroll_speed);
+ mAutoScrolling = TRUE;
+ }
scrolling = true;
}
}