diff options
Diffstat (limited to 'indra/llui/llflatlistview.cpp')
-rw-r--r-- | indra/llui/llflatlistview.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 64a4824a17..7b7a3139a4 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -530,7 +530,8 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask) if ( !selectNextItemPair(true, reset_selection) && reset_selection) { // If case we are in accordion tab notify parent to go to the previous accordion - notifyParent(LLSD().with("action","select_prev")); + if(notifyParent(LLSD().with("action","select_prev")) > 0 )//message was processed + resetSelection(); } break; } @@ -539,7 +540,8 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask) if ( !selectNextItemPair(false, reset_selection) && reset_selection) { // If case we are in accordion tab notify parent to go to the next accordion - notifyParent(LLSD().with("action","select_next")); + if( notifyParent(LLSD().with("action","select_next")) > 0 ) //message was processed + resetSelection(); } break; } @@ -558,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(); @@ -570,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; } @@ -692,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())); } |