Skip to content

Commit

Permalink
#2696 The viewer crashes on gestures floater (fix navigation)
Browse files Browse the repository at this point in the history
  • Loading branch information
LLGuru committed Oct 9, 2024
1 parent 0f9d2dc commit a7adadd
Showing 1 changed file with 43 additions and 44 deletions.
87 changes: 43 additions & 44 deletions indra/llui/llscrolllistctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1105,38 +1105,32 @@ S32 LLScrollListCtrl::getItemIndex( const LLUUID& target_id ) const

void LLScrollListCtrl::selectPrevItem( bool extend_selection)
{
updateSort();

LLScrollListItem* prev_item = NULL;

if (!getFirstSelected())
{
// select last item
selectNthItem(getItemCount() - 1);
}
else
for (LLScrollListItem* item : mItemList)
{
updateSort();

item_list::iterator iter;
for (LLScrollListItem* cur_item : mItemList)
if (item->getSelected())
{
if (cur_item->getSelected())
{
if (prev_item)
{
selectItem(prev_item, cur_item->getSelectedCell(), !extend_selection);
}
else
{
reportInvalidInput();
}
break;
}
break;
}

// don't allow navigation to disabled elements
prev_item = cur_item->getEnabled() ? cur_item : prev_item;
// don't allow navigation to disabled elements
if (item->getEnabled())
{
prev_item = item;
}
}

if (!prev_item)
{
reportInvalidInput();
return;
}

selectItem(prev_item, prev_item->getSelectedCell(), !extend_selection);

if ((mCommitOnSelectionChange || mCommitOnKeyboardMovement))
{
commitIfChanged();
Expand All @@ -1147,36 +1141,41 @@ void LLScrollListCtrl::selectPrevItem( bool extend_selection)

void LLScrollListCtrl::selectNextItem( bool extend_selection)
{
updateSort();

LLScrollListItem* current_item = NULL;
LLScrollListItem* next_item = NULL;

if (!getFirstSelected())
{
selectFirstItem();
}
else
for (LLScrollListItem* item : mItemList)
{
updateSort();

for (LLScrollListItem* cur_item : mItemList)
if (current_item)
{
if (cur_item->getSelected())
if (item->getEnabled())
{
if (next_item)
{
selectItem(next_item, cur_item->getSelectedCell(), !extend_selection);
}
else
{
reportInvalidInput();
}
next_item = item;
break;
}

// don't allow navigation to disabled items
next_item = cur_item->getEnabled() ? cur_item : next_item;
}
else if (item->getSelected())
{
current_item = item;
next_item = NULL;
continue;
}
else if (!next_item && item->getEnabled())
{
next_item = item;
}
}

if (!next_item)
{
reportInvalidInput();
return;
}

selectItem(next_item, next_item->getSelectedCell(), !extend_selection);

if (mCommitOnKeyboardMovement)
{
onCommit();
Expand Down

0 comments on commit a7adadd

Please sign in to comment.