diff options
author | Paul Guslisty <pguslisty@productengine.com> | 2009-12-21 18:25:10 +0200 |
---|---|---|
committer | Paul Guslisty <pguslisty@productengine.com> | 2009-12-21 18:25:10 +0200 |
commit | e2de2c2b71c3f6d10191343ec114e34f6ad236f9 (patch) | |
tree | b13cb3f244efb4216dd8ac7635d4f90fd618b192 /indra | |
parent | 2305676fed6f1bbb0802a0e660f96874c54c2efd (diff) | |
parent | d43a03d5c8a71e5c16154289c15641aa1635b527 (diff) |
merge
--HG--
branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/llflatlistview.cpp | 24 | ||||
-rw-r--r-- | indra/llui/llflatlistview.h | 2 |
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;} |