summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2009-12-21 13:03:14 -0800
committerTofu Linden <tofu.linden@lindenlab.com>2009-12-21 13:03:14 -0800
commit2f91768d96683515383570c8aae21bd126fd0ad6 (patch)
tree8c0a34f7e5aa4ae519d3c10e1c6fc8e9b83cb006 /indra/llui
parentd74d0d5c41d5ea114cef19aa7e54834d1c3b554b (diff)
parent0e6f0e5ca16f534ff14c57c77c323bed2d6e730c (diff)
merge.
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llflatlistview.cpp24
-rw-r--r--indra/llui/llflatlistview.h2
2 files changed, 25 insertions, 1 deletions
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index 09124c3013..7b7a3139a4 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -560,6 +560,8 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
if ( ( key == KEY_UP || key == KEY_DOWN ) && mSelectedItemPairs.size() )
{
+ ensureSelectedVisible();
+ /*
LLRect visible_rc = getVisibleContentRect();
LLRect selected_rc = getLastSelectedItemRect();
@@ -572,7 +574,8 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
// In case we are in accordion tab notify parent to show selected rectangle
LLRect screen_rc;
localRectToScreen(selected_rc, &screen_rc);
- notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));
+ notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));*/
+
handled = TRUE;
}
@@ -694,11 +697,30 @@ LLRect LLFlatListView::getSelectedItemsRect()
void LLFlatListView::selectFirstItem ()
{
selectItemPair(mItemPairs.front(), true);
+ ensureSelectedVisible();
}
void LLFlatListView::selectLastItem ()
{
selectItemPair(mItemPairs.back(), true);
+ ensureSelectedVisible();
+}
+
+void LLFlatListView::ensureSelectedVisible()
+{
+ LLRect visible_rc = getVisibleContentRect();
+ LLRect selected_rc = getLastSelectedItemRect();
+
+ if ( !visible_rc.contains (selected_rc) )
+ {
+ // But scroll in Items panel coordinates
+ scrollToShowRect(selected_rc);
+ }
+
+ // In case we are in accordion tab notify parent to show selected rectangle
+ LLRect screen_rc;
+ localRectToScreen(selected_rc, &screen_rc);
+ notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));
}
diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h
index ba824ff2df..26e84a6fe1 100644
--- a/indra/llui/llflatlistview.h
+++ b/indra/llui/llflatlistview.h
@@ -359,6 +359,8 @@ protected:
LLRect getSelectedItemsRect();
+ void ensureSelectedVisible();
+
private:
void setItemsNoScrollWidth(S32 new_width) {mItemsNoScrollWidth = new_width - 2 * mBorderThickness;}