diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-06-02 21:24:15 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-06-02 21:24:15 +0300 |
commit | 07fc011e209ab24069d06df961a000dc7d6de3cf (patch) | |
tree | 53c0cb5d27430f28b90e0957a046ffd7ec84e44b /indra | |
parent | 959829bb7ef737bd5d9748dd27e074d23974e654 (diff) |
SL-19796 Creating folders in list mode does not scroll to new folder
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/llfolderview.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 21 |
2 files changed, 29 insertions, 12 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 70c2a79d25..19855c9c76 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -695,12 +695,20 @@ void LLFolderView::draw() } } - if (mRenameItem && mRenamer && mRenamer->getVisible() && !getVisibleRect().overlaps(mRenamer->getRect())) - { - // renamer is not connected to the item we are renaming in any form so manage it manually - // TODO: consider stopping on any scroll action instead of when out of visible area - finishRenamingItem(); - } + if (mRenameItem + && mRenamer + && mRenamer->getVisible() + ) + { + LLRect renamer_rect; + localRectToOtherView(mRenamer->getRect(), &renamer_rect, mScrollContainer); + if (!mScrollContainer->getRect().overlaps(renamer_rect)) + { + // renamer is not connected to the item we are renaming in any form so manage it manually + // TODO: consider stopping on any scroll action instead of when out of visible area + finishRenamingItem(); + } + } // skip over LLFolderViewFolder::draw since we don't want the folder icon, label, // and arrow for the root folder diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index e4de6078f3..afb69d9b6d 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -515,11 +515,17 @@ void LLPanelMainInventory::doCreate(const LLSD& userdata) mForceShowInvLayout = true; } - std::function<void(const LLUUID&)> callback_cat_created = [this](const LLUUID& new_category_id) + LLHandle<LLPanel> handle = mCombinationInventoryPanel->getHandle(); + std::function<void(const LLUUID&)> callback_cat_created = [handle](const LLUUID& new_category_id) { - gInventory.notifyObservers(); - mCombinationInventoryPanel->setSelectionByID(new_category_id, TRUE); - mCombinationInventoryPanel->getRootFolder()->setNeedsAutoRename(TRUE); + gInventory.notifyObservers(); // not really needed, should have been already done + LLInventorySingleFolderPanel* panel = (LLInventorySingleFolderPanel*)handle.get(); + if (new_category_id.notNull() && panel) + { + panel->setSelectionByID(new_category_id, TRUE); + panel->getRootFolder()->scrollToShowSelection(); + panel->getRootFolder()->setNeedsAutoRename(TRUE); + } }; menu_create_inventory_item(NULL, getCurrentSFVRoot(), userdata, LLUUID::null, callback_cat_created); } @@ -528,8 +534,11 @@ void LLPanelMainInventory::doCreate(const LLSD& userdata) { std::function<void(const LLUUID&)> callback_cat_created = [this](const LLUUID &new_category_id) { - gInventory.notifyObservers(); - setGallerySelection(new_category_id); + gInventory.notifyObservers(); // not really needed, should have been already done + if (new_category_id.notNull()) + { + setGallerySelection(new_category_id); + } }; menu_create_inventory_item(NULL, getCurrentSFVRoot(), userdata, LLUUID::null, callback_cat_created); } |