summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-10-02 21:44:31 +0300
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-10-07 19:20:44 +0300
commit18f3ecfc04f937f2034afafff8d037b8b25d303d (patch)
tree480fe041b0580f701b5033a11b225c15fe20fef9 /indra
parentc6f469a2b48bea9074f3e5def581a4330e5c9428 (diff)
SL-20383 Fix scroll locking view
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llfolderview.h1
-rw-r--r--indra/newview/llinventorypanel.cpp86
-rw-r--r--indra/newview/llinventorypanel.h2
3 files changed, 50 insertions, 39 deletions
diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h
index 6de366044c..5f8a173889 100644
--- a/indra/llui/llfolderview.h
+++ b/indra/llui/llfolderview.h
@@ -217,6 +217,7 @@ public:
virtual void draw();
virtual void deleteAllChildren();
+ void stopAutoScollining() {mNeedsScroll = false;}
void scrollToShowSelection();
void scrollToShowItem(LLFolderViewItem* item, const LLRect& constraint_rect);
void setScrollContainer( LLScrollContainer* parent ) { mScrollContainer = parent; }
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 355d222b27..154d8e2e18 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -1449,45 +1449,6 @@ void LLInventoryPanel::onFocusReceived()
// inventory now handles cut/copy/paste/delete
LLEditMenuHandler::gEditMenuHandler = mFolderRoot.get();
- // Tab support, when tabbing into this view, select first item
- // (ideally needs to account for scroll)
- bool select_first = mSelectThisID.isNull() && mFolderRoot.get() && mFolderRoot.get()->getSelectedCount() == 0;
-
- if (select_first)
- {
- LLFolderViewFolder::folders_t::const_iterator folders_it = mFolderRoot.get()->getFoldersBegin();
- LLFolderViewFolder::folders_t::const_iterator folders_end = mFolderRoot.get()->getFoldersEnd();
-
- for (; folders_it != folders_end; ++folders_it)
- {
- const LLFolderViewFolder* folder_view = *folders_it;
- if (folder_view->getVisible())
- {
- const LLFolderViewModelItemInventory* modelp = static_cast<const LLFolderViewModelItemInventory*>(folder_view->getViewModelItem());
- setSelectionByID(modelp->getUUID(), TRUE);
- select_first = false;
- break;
- }
- }
- }
-
- if (select_first)
- {
- LLFolderViewFolder::items_t::const_iterator items_it = mFolderRoot.get()->getItemsBegin();
- LLFolderViewFolder::items_t::const_iterator items_end = mFolderRoot.get()->getItemsEnd();
-
- for (; items_it != items_end; ++items_it)
- {
- const LLFolderViewItem* item_view = *items_it;
- if (item_view->getVisible())
- {
- const LLFolderViewModelItemInventory* modelp = static_cast<const LLFolderViewModelItemInventory*>(item_view->getViewModelItem());
- setSelectionByID(modelp->getUUID(), TRUE);
- break;
- }
- }
- }
-
LLPanel::onFocusReceived();
}
@@ -2258,6 +2219,53 @@ void LLInventorySingleFolderPanel::initFromParams(const Params& p)
LLPanel::initFromParams(mParams);
}
+void LLInventorySingleFolderPanel::onFocusReceived()
+{
+ // Tab support, when tabbing into this view, select first item
+ // (ideally needs to account for scroll)
+ bool select_first = mSelectThisID.isNull() && mFolderRoot.get() && mFolderRoot.get()->getSelectedCount() == 0;
+
+ if (select_first)
+ {
+ LLFolderViewFolder::folders_t::const_iterator folders_it = mFolderRoot.get()->getFoldersBegin();
+ LLFolderViewFolder::folders_t::const_iterator folders_end = mFolderRoot.get()->getFoldersEnd();
+
+ for (; folders_it != folders_end; ++folders_it)
+ {
+ const LLFolderViewFolder* folder_view = *folders_it;
+ if (folder_view->getVisible())
+ {
+ const LLFolderViewModelItemInventory* modelp = static_cast<const LLFolderViewModelItemInventory*>(folder_view->getViewModelItem());
+ setSelectionByID(modelp->getUUID(), TRUE);
+ // quick and dirty fix: don't scroll on switching focus
+ // todo: better 'tab' support, one that would work for LLInventoryPanel
+ mFolderRoot.get()->stopAutoScollining();
+ select_first = false;
+ break;
+ }
+ }
+ }
+
+ if (select_first)
+ {
+ LLFolderViewFolder::items_t::const_iterator items_it = mFolderRoot.get()->getItemsBegin();
+ LLFolderViewFolder::items_t::const_iterator items_end = mFolderRoot.get()->getItemsEnd();
+
+ for (; items_it != items_end; ++items_it)
+ {
+ const LLFolderViewItem* item_view = *items_it;
+ if (item_view->getVisible())
+ {
+ const LLFolderViewModelItemInventory* modelp = static_cast<const LLFolderViewModelItemInventory*>(item_view->getViewModelItem());
+ setSelectionByID(modelp->getUUID(), TRUE);
+ mFolderRoot.get()->stopAutoScollining();
+ break;
+ }
+ }
+ }
+ LLInventoryPanel::onFocusReceived();
+}
+
void LLInventorySingleFolderPanel::initFolderRoot(const LLUUID& start_folder_id)
{
if(mRootInited) return;
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 4d69bdf17d..b68433bab0 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -404,6 +404,8 @@ public:
{};
void initFromParams(const Params& p);
+ void onFocusReceived() override;
+
bool isSelectionRemovable() { return false; }
void initFolderRoot(const LLUUID& start_folder_id = LLUUID::null);