diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-06-03 02:05:17 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-06-03 02:05:17 +0300 |
commit | fb248ad2bc106bad827e624b4bb6b99a3f97d266 (patch) | |
tree | 7d9bc7c94ce7f505caff0c69c8ea326344069441 | |
parent | ac5c62de965f3e6547cec657bb97c55ebaa40c53 (diff) |
SL-19815 Gallery support for left, right, up and down
-rw-r--r-- | indra/llui/llscrollbar.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llinventorygallery.cpp | 53 | ||||
-rw-r--r-- | indra/newview/llinventorygallery.h | 1 |
3 files changed, 59 insertions, 2 deletions
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index fde6de4921..62be0c28e8 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -591,7 +591,12 @@ void LLScrollbar::setValue(const LLSD& value) BOOL LLScrollbar::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + if (getDocPosMax() == 0 && !getVisible()) + { + return FALSE; + } + + BOOL handled = FALSE; switch( key ) { diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index f791521e3e..80bfbb8d23 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -421,8 +421,9 @@ void LLInventoryGallery::addToGallery(LLInventoryGalleryItem* item) mHiddenItems.push_back(item); return; } + mItemIndexMap[item] = mItemsAddedCount; + mIndexToItemMap[mItemsAddedCount] = item; mItemsAddedCount++; - mItemIndexMap[item] = mItemsAddedCount - 1; int n = mItemsAddedCount; int row_count = (n % mItemsInRow) == 0 ? n / mItemsInRow : n / mItemsInRow + 1; int n_prev = n - 1; @@ -458,6 +459,7 @@ void LLInventoryGallery::removeFromGalleryLast(LLInventoryGalleryItem* item) int row_count = (n % mItemsInRow) == 0 ? n / mItemsInRow : n / mItemsInRow + 1; int row_count_prev = (n_prev % mItemsInRow) == 0 ? n_prev / mItemsInRow : n_prev / mItemsInRow + 1; mItemsAddedCount--; + mIndexToItemMap.erase(mItemsAddedCount); bool remove_row = row_count != row_count_prev; removeFromLastRow(mItems[mItemsAddedCount]); @@ -483,6 +485,7 @@ void LLInventoryGallery::removeFromGalleryMiddle(LLInventoryGalleryItem* item) } int n = mItemIndexMap[item]; mItemIndexMap.erase(item); + mIndexToItemMap.erase(n); std::vector<LLInventoryGalleryItem*> saved; for (int i = mItemsAddedCount - 1; i > n; i--) { @@ -949,6 +952,54 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) handled = TRUE; break; + case KEY_LEFT: + mFilterSubString.clear(); + + if (mInventoryGalleryMenu && mSelectedItemID.notNull() && mItemsAddedCount > 1) + { + LLInventoryGalleryItem* item = getSelectedItem(); + if (item) + { + // Might be better to get item from panel + S32 n = mItemIndexMap[item]; + if (n == 0) + { + n = mItemsAddedCount - 1; + } + n--; + item = mIndexToItemMap[n]; + LLUUID item_id = item->getUUID(); + changeItemSelection(item_id, true); + item->setFocus(TRUE); + + } + } + handled = TRUE; + break; + + case KEY_RIGHT: + mFilterSubString.clear(); + + if (mInventoryGalleryMenu && mSelectedItemID.notNull() && mItemsAddedCount > 1) + { + LLInventoryGalleryItem* item = getSelectedItem(); + if (item) + { + S32 n = mItemIndexMap[item]; + n++; + if (n == mItemsAddedCount) + { + n = 0; + } + item = mIndexToItemMap[n]; + LLUUID item_id = item->getUUID(); + changeItemSelection(item_id, true); + item->setFocus(TRUE); + } + } + handled = TRUE; + break; + default: break; } diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h index de0cba6e63..7d4431dbfb 100644 --- a/indra/newview/llinventorygallery.h +++ b/indra/newview/llinventorygallery.h @@ -215,6 +215,7 @@ private: uuid_vec_t mCOFLinkedItems; uuid_vec_t mActiveGestures; std::map<LLInventoryGalleryItem*, S32> mItemIndexMap; + std::map<S32, LLInventoryGalleryItem*> mIndexToItemMap; LLInventoryFilter::ESearchType mSearchType; std::string mUsername; |