summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorygallery.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventorygallery.cpp')
-rw-r--r--indra/newview/llinventorygallery.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp
index fa50261c9b..271cc3e037 100644
--- a/indra/newview/llinventorygallery.cpp
+++ b/indra/newview/llinventorygallery.cpp
@@ -1254,12 +1254,26 @@ void LLInventoryGallery::onFocusReceived()
// inventory now handles cut/copy/paste/delete
gEditMenuHandler = this;
- LLPanel::onFocusReceived();
-
+ // Tab support, when tabbing into this view, select first item
if (mSelectedItemID.notNull() && mItemMap[mSelectedItemID])
{
- mItemMap[mSelectedItemID]->setSelected(true);
+ LLInventoryGalleryItem* focus_item = mItemMap[mSelectedItemID];
+ focus_item->setSelected(true);
+ focus_item->setFocus(TRUE);
}
+ else if (mIndexToItemMap.size() > 0)
+ {
+ // choose any items from visible rect
+ S32 vert_offset = mScrollPanel->getDocPosVertical();
+ S32 panel_size = mVerticalGap + mRowPanelHeight;
+ S32 n = llclamp((S32)(vert_offset / panel_size) * mItemsInRow, 0, (S32)(mIndexToItemMap.size() - 1) );
+
+ LLInventoryGalleryItem* focus_item = mIndexToItemMap[n];
+ changeItemSelection(focus_item->getUUID(), true);
+ focus_item->setFocus(TRUE);
+ }
+
+ LLPanel::onFocusReceived();
}
void LLInventoryGallery::showContextMenu(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& item_id)