diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-06-01 00:14:06 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-06-01 00:14:06 +0300 |
commit | c6eeb65d18861ea346cf199faba7bf3f493fdabe (patch) | |
tree | df8205169f1d93e44a4565c4c2209e78d2be52bf /indra | |
parent | 49b817d5062dbffb915facc3cda7e31dd2322e6e (diff) |
SL-19795 Smarter combination inventory resizing
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llinventorypanel.h | 1 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 51 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.h | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_main_inventory.xml | 1 |
4 files changed, 54 insertions, 0 deletions
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 61d59e001e..54ecdc8322 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -214,6 +214,7 @@ public: LLUUID getRootFolderID(); LLScrollContainer* getScrollableContainer() { return mScroller; } bool getAllowDropOnRoot() { return mParams.allow_drop_on_root; } + bool areViewsInitialized() { return mViewsInitialized == VIEWS_INITIALIZED && mFolderRoot.get() && !mFolderRoot.get()->needsArrange(); } void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 52cf2f1d54..3c867f0e90 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -1518,6 +1518,7 @@ void LLPanelMainInventory::toggleViewMode() } mSingleFolderMode = !mSingleFolderMode; + mReshapeInvLayout = true; if (mCombinationGalleryPanel->getRootFolder().isNull()) { @@ -2282,6 +2283,7 @@ void LLPanelMainInventory::onCombinationRootChanged(bool gallery_clicked) } mForceShowInvLayout = false; updateTitle(); + mReshapeInvLayout = true; } void LLPanelMainInventory::onCombinationGallerySelectionChanged(const LLUUID& category_id) @@ -2321,6 +2323,55 @@ void LLPanelMainInventory::updateCombinationVisibility() } getActivePanel()->getRootFolder(); + + if (mReshapeInvLayout + && show_inv_pane + && mCombinationGalleryPanel->hasVisibleItems() + && mCombinationInventoryPanel->areViewsInitialized()) + { + mReshapeInvLayout = false; + + // force drop previous shape (because panel doesn't decrease shape properly) + LLRect list_latout = mCombinationListLayoutPanel->getRect(); + list_latout.mTop = list_latout.mBottom; // min height is at 100, so it should snap to be bigger + mCombinationListLayoutPanel->setShape(list_latout, false); + + LLRect inv_inner_rect = mCombinationInventoryPanel->getScrollableContainer()->getScrolledViewRect(); + S32 inv_height = inv_inner_rect.getHeight() + + (mCombinationInventoryPanel->getScrollableContainer()->getBorderWidth() * 2) + + mCombinationInventoryPanel->getScrollableContainer()->getSize(); + LLRect inner_galery_rect = mCombinationGalleryPanel->getScrollableContainer()->getScrolledViewRect(); + S32 gallery_height = inner_galery_rect.getHeight() + + (mCombinationGalleryPanel->getScrollableContainer()->getBorderWidth() * 2) + + mCombinationGalleryPanel->getScrollableContainer()->getSize(); + LLRect layout_rect = mCombinationViewPanel->getRect(); + + // by default make it take 1/3 of the panel + S32 list_default_height = layout_rect.getHeight() / 3; + // Don't set height from gallery_default_height - needs to account for a resizer in such case + S32 gallery_default_height = layout_rect.getHeight() - list_default_height; + + if (inv_height > list_default_height + && gallery_height < gallery_default_height) + { + LLRect gallery_latout = mCombinationGalleryLayoutPanel->getRect(); + gallery_latout.mTop = gallery_latout.mBottom + gallery_height; + mCombinationGalleryLayoutPanel->setShape(gallery_latout, true /*tell stack to account for new shape*/); + } + else if (inv_height < list_default_height + && gallery_height > gallery_default_height) + { + LLRect list_latout = mCombinationListLayoutPanel->getRect(); + list_latout.mTop = list_latout.mBottom + inv_height; + mCombinationListLayoutPanel->setShape(list_latout, true /*tell stack to account for new shape*/); + } + else + { + LLRect list_latout = mCombinationListLayoutPanel->getRect(); + list_latout.mTop = list_latout.mBottom + list_default_height; + mCombinationListLayoutPanel->setShape(list_latout, true /*tell stack to account for new shape*/); + } + } } } diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index daf7cf5ad3..a02c13ddde 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -252,6 +252,7 @@ private: bool mNeedUploadCost; bool mForceShowInvLayout; + bool mReshapeInvLayout; bool mDelayedCombGalleryScroll; bool mDelayedCombInvPanelScroll; // List Commands // diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml index b3ca712aee..53803f8067 100644 --- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml @@ -381,6 +381,7 @@ auto_resize="true" height="126" width="312" + min_height="100" name="comb_inventory_layout"> <single_folder_inventory_panel name="comb_single_folder_inv" |