additional fix for (EXT-3601) Accordion Ctrl didn't autoscroll to accordion header while navigating with keyboard

there was no autoscroll when scrolled by keyboard to _last_ of _first_ item in LLFlatListView.

--HG--
branch : product-engine
meow-7.2.2
Yuri Chebotarev 2009-12-21 18:15:44 +02:00
parent c353e640fa
commit aa56836ab7
2 changed files with 25 additions and 1 deletions

View File

@ -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()));
}

View File

@ -359,6 +359,8 @@ protected:
LLRect getSelectedItemsRect();
void ensureSelectedVisible();
private:
void setItemsNoScrollWidth(S32 new_width) {mItemsNoScrollWidth = new_width - 2 * mBorderThickness;}