summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2009-12-07 15:15:52 -0800
committerJames Cook <james@lindenlab.com>2009-12-07 15:15:52 -0800
commit81c18d54426ffe8a331350ac975770f36b5df201 (patch)
treef9f9001125deb40141c52cdf593131d32b01a5e0
parent13c998c34ac2c1f134b4c6998413753f94e1a002 (diff)
EXT-3159 Mouse-wheel scrolling down causes unexpected side-scrolling
If vertical scroll bar is visible, give it the scroll events and don't scroll horizontally. Eliminated extraneous folder view item scroll handler. Reviewed with Richard.
-rw-r--r--indra/llui/llscrollcontainer.cpp31
-rw-r--r--indra/newview/llfolderviewitem.cpp9
-rw-r--r--indra/newview/llfolderviewitem.h1
-rw-r--r--indra/newview/skins/default/xui/en/floater_test_text_editor.xml12
4 files changed, 36 insertions, 17 deletions
diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index f6caed4617..a5e47e8547 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -235,18 +235,37 @@ BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask)
BOOL LLScrollContainer::handleScrollWheel( S32 x, S32 y, S32 clicks )
{
- if(LLUICtrl::handleScrollWheel(x,y,clicks))
+ // Give event to my child views - they may have scroll bars
+ // (Bad UI design, but technically possible.)
+ if (LLUICtrl::handleScrollWheel(x,y,clicks))
return TRUE;
- for( S32 i = 0; i < SCROLLBAR_COUNT; i++ )
- {
- // Note: tries vertical and then horizontal
+ // When the vertical scrollbar is visible, scroll wheel
+ // only affects vertical scrolling. It's confusing to have
+ // scroll wheel perform both vertical and horizontal in a
+ // single container.
+ LLScrollbar* vertical = mScrollbar[VERTICAL];
+ if (vertical->getVisible()
+ && vertical->getEnabled())
+ {
// Pretend the mouse is over the scrollbar
- if( mScrollbar[i]->handleScrollWheel( 0, 0, clicks ) )
+ if (vertical->handleScrollWheel( 0, 0, clicks ) )
{
updateScroll();
- return TRUE;
}
+ // Always eat the event
+ return TRUE;
+ }
+
+ LLScrollbar* horizontal = mScrollbar[HORIZONTAL];
+ // Test enablement and visibility for consistency with
+ // LLView::childrenHandleScrollWheel().
+ if (horizontal->getVisible()
+ && horizontal->getEnabled()
+ && horizontal->handleScrollWheel( 0, 0, clicks ) )
+ {
+ updateScroll();
+ return TRUE;
}
return FALSE;
}
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 63511301b3..fdc5c053fc 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -735,15 +735,6 @@ BOOL LLFolderViewItem::handleDoubleClick( S32 x, S32 y, MASK mask )
return TRUE;
}
-BOOL LLFolderViewItem::handleScrollWheel(S32 x, S32 y, S32 clicks)
-{
- if (getParent())
- {
- return getParent()->handleScrollWheel(x, y, clicks);
- }
- return FALSE;
-}
-
BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask )
{
if (LLView::childrenHandleMouseUp(x, y, mask))
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h
index f6264ec968..9683d17096 100644
--- a/indra/newview/llfolderviewitem.h
+++ b/indra/newview/llfolderviewitem.h
@@ -319,7 +319,6 @@ public:
virtual BOOL handleHover( S32 x, S32 y, MASK mask );
virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
- virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
// virtual void handleDropped();
virtual void draw();
diff --git a/indra/newview/skins/default/xui/en/floater_test_text_editor.xml b/indra/newview/skins/default/xui/en/floater_test_text_editor.xml
index b0aa5c7c4f..8be0c28c5c 100644
--- a/indra/newview/skins/default/xui/en/floater_test_text_editor.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_text_editor.xml
@@ -9,7 +9,6 @@
<text_editor
height="50"
follows="top|left|bottom"
- layout="topleft"
left="10"
name="test_text_editor"
tool_tip="text editor"
@@ -17,4 +16,15 @@
width="200">
Text Editor
</text_editor>
+ <text_editor
+ height="50"
+ follows="top|left|bottom"
+ font="SansSerif"
+ left="10"
+ name="test_text_editor"
+ tool_tip="text editor"
+ top_pad="10"
+ width="200">
+ This contains long text and should scroll horizontally to the right
+ </text_editor>
</floater>