summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-05-05 18:17:00 +0300
committerMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-05-05 18:17:00 +0300
commit61818417d619c8d17cf861f0d72b314a14269e2f (patch)
treec8f162d81791c621e38d40cebf50275933837d4b
parent98681ef73ff33e0c0ff321e839a8e79b2cb334de (diff)
SL-19641 FIXED Gallery item is not selected after using 'Find original'
-rw-r--r--indra/newview/llinventorygallery.cpp5
-rw-r--r--indra/newview/llinventorygallery.h1
-rw-r--r--indra/newview/llpanelmaininventory.cpp70
-rw-r--r--indra/newview/llpanelmaininventory.h7
4 files changed, 76 insertions, 7 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp
index a078d6c81d..37801c8dd5 100644
--- a/indra/newview/llinventorygallery.cpp
+++ b/indra/newview/llinventorygallery.cpp
@@ -882,6 +882,11 @@ void LLInventoryGallery::scrollToShowItem(const LLUUID& item_id)
}
}
+LLInventoryGalleryItem* LLInventoryGallery::getSelectedItem()
+{
+ return mItemMap[mSelectedItemID];
+}
+
void LLInventoryGallery::updateMessageVisibility()
{
diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h
index 2cf038b7d8..dfb7be6a86 100644
--- a/indra/newview/llinventorygallery.h
+++ b/indra/newview/llinventorygallery.h
@@ -129,6 +129,7 @@ public:
bool hasVisibleItems();
void handleModifiedFilter();
LLScrollContainer* getScrollableContainer() { return mScrollPanel; }
+ LLInventoryGalleryItem* getSelectedItem();
protected:
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index b0422b7bd9..2f6276ff77 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -122,7 +122,9 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p)
mViewMode(MODE_COMBINATION),
mCombinationShapeDirty(true),
mListViewRootUpdatedConnection(),
- mGalleryRootUpdatedConnection()
+ mGalleryRootUpdatedConnection(),
+ mDelayedCombGalleryScroll(false),
+ mDelayedCombInvPanelScroll(false)
{
// Menu Callbacks (non contex menus)
mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLPanelMainInventory::doToSelected, this, _2));
@@ -466,7 +468,7 @@ void LLPanelMainInventory::newFolderWindow(LLUUID folder_id, LLUUID item_to_sele
main_inventory->setFocus(true);
if(item_to_select.notNull())
{
- sidepanel_inventory->getActivePanel()->setSelection(item_to_select, TAKE_FOCUS_YES);
+ main_inventory->setGallerySelection(item_to_select);
}
return;
}
@@ -491,7 +493,7 @@ void LLPanelMainInventory::newFolderWindow(LLUUID folder_id, LLUUID item_to_sele
main_inventory->setSingleFolderViewRoot(folder_id);
if(item_to_select.notNull())
{
- sidepanel_inventory->getActivePanel()->setSelection(item_to_select, TAKE_FOCUS_YES);
+ main_inventory->setGallerySelection(item_to_select, true);
}
}
}
@@ -2345,6 +2347,15 @@ void LLPanelMainInventory::updateCombinationVisibility()
mCombinationScroller->reshape(desired_width, inv_rect.getHeight() + galery_rect.getHeight(), true);
mCombinationGalleryPanel->setShape(galery_rect, false);
mCombinationInventoryPanel->setShape(inv_rect, false);
+
+ if(mDelayedCombGalleryScroll)
+ {
+ scrollToGallerySelection();
+ }
+ else if(mDelayedCombInvPanelScroll)
+ {
+ scrollToInvPanelSelection();
+ }
}
}
@@ -2478,7 +2489,7 @@ LLInventoryFilter& LLPanelMainInventory::getCurrentFilter()
}
}
-void LLPanelMainInventory::setGallerySelection(const LLUUID& item_id)
+void LLPanelMainInventory::setGallerySelection(const LLUUID& item_id, bool new_window)
{
if(mSingleFolderMode && isGalleryViewMode())
{
@@ -2488,13 +2499,60 @@ void LLPanelMainInventory::setGallerySelection(const LLUUID& item_id)
{
if(mCombinationGalleryPanel->getFilter().checkAgainstFilterThumbnails(item_id))
{
- mCombinationGalleryPanel->changeItemSelection(item_id, true);
+ mCombinationGalleryPanel->changeItemSelection(item_id, false);
+ if(new_window)
+ {
+ mDelayedCombGalleryScroll = new_window;
+ }
+ else
+ {
+ scrollToGallerySelection();
+ }
}
else
{
- mCombinationInventoryPanel->setSelection(item_id, false);
+ mCombinationInventoryPanel->setSelection(item_id, true);
+ if(new_window)
+ {
+ mDelayedCombInvPanelScroll = new_window;
+ }
+ else
+ {
+ scrollToInvPanelSelection();
+ }
}
}
+ else if (mSingleFolderMode && isListViewMode())
+ {
+ mSingleFolderPanelInventory->setSelection(item_id, true);
+ }
+}
+
+void LLPanelMainInventory::scrollToGallerySelection()
+{
+ LLInventoryGalleryItem* item = mCombinationGalleryPanel->getSelectedItem();
+ LLScrollContainer* scroll_panel = getChild<LLScrollContainer>("combination_view_inventory");
+
+ if(item)
+ {
+ LLRect item_rect;
+ item->localRectToOtherView(item->getLocalRect(), &item_rect, mCombinationScroller);
+ scroll_panel->scrollToShowRect(item_rect);
+ }
}
+
+void LLPanelMainInventory::scrollToInvPanelSelection()
+{
+ LLFolderViewItem* item = mCombinationInventoryPanel->getRootFolder()->getCurSelectedItem();
+ LLScrollContainer* scroll_panel = getChild<LLScrollContainer>("combination_view_inventory");
+
+ if(item)
+ {
+ LLRect item_rect;
+ item->localRectToOtherView(item->getLocalRect(), &item_rect, mCombinationScroller);
+ scroll_panel->scrollToShowRect(item_rect);
+ }
+}
+
// List Commands //
////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h
index 21e08bbac8..44beba6b4f 100644
--- a/indra/newview/llpanelmaininventory.h
+++ b/indra/newview/llpanelmaininventory.h
@@ -120,10 +120,13 @@ public:
void onBackFolderClicked();
void onForwardFolderClicked();
void setSingleFolderViewRoot(const LLUUID& folder_id, bool clear_nav_history = true);
- void setGallerySelection(const LLUUID& item_id);
+ void setGallerySelection(const LLUUID& item_id, bool new_window = false);
LLUUID getSingleFolderViewRoot();
bool isSingleFolderMode() { return mSingleFolderMode; }
+ void scrollToGallerySelection();
+ void scrollToInvPanelSelection();
+
void setViewMode(EViewModeType mode);
bool isListViewMode() { return (mViewMode == MODE_LIST); }
bool isGalleryViewMode() { return (mViewMode == MODE_GALLERY); }
@@ -236,6 +239,8 @@ private:
bool mForceShowInvLayout;
bool mCombinationShapeDirty;
+ bool mDelayedCombGalleryScroll;
+ bool mDelayedCombInvPanelScroll;
// List Commands //
////////////////////////////////////////////////////////////////////////////////
};