From 07fc011e209ab24069d06df961a000dc7d6de3cf Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 2 Jun 2023 21:24:15 +0300 Subject: SL-19796 Creating folders in list mode does not scroll to new folder --- indra/newview/llpanelmaininventory.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanelmaininventory.cpp') 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 callback_cat_created = [this](const LLUUID& new_category_id) + LLHandle handle = mCombinationInventoryPanel->getHandle(); + std::function 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 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); } -- cgit v1.2.3