Skip to content
Snippets Groups Projects
Commit 4e4dd527 authored by Eugene Mutavchi's avatar Eugene Mutavchi
Browse files

Fixed low bug EXT-6823 (Implement a possibility to select several residents by...

Fixed low bug EXT-6823 (Implement a possibility to select several residents by "Shift" button) - improved the selection of list items by mouse.
Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/238/

--HG--
branch : product-engine
parent 960eb2c6
No related branches found
No related tags found
No related merge requests found
......@@ -504,7 +504,68 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask)
//*TODO find a better place for that enforcing stuff
if (mKeepOneItemSelected && numSelected() == 1 && !select_item) return;
if ( (mask & MASK_SHIFT) && !(mask & MASK_CONTROL)
&& mMultipleSelection && !mSelectedItemPairs.empty() )
{
item_pair_t* last_selected_pair = mSelectedItemPairs.back();
// If item_pair is already selected - do nothing
if (last_selected_pair == item_pair)
return;
bool grab_items = false;
pairs_list_t pairs_to_select;
// Pick out items from list between last selected and current clicked item_pair.
for (pairs_iterator_t
iter = mItemPairs.begin(),
iter_end = mItemPairs.end();
iter != iter_end; ++iter)
{
item_pair_t* cur = *iter;
if (cur == last_selected_pair || cur == item_pair)
{
grab_items = !grab_items;
// Skip last selected and current clicked item pairs.
continue;
}
if (!cur->first->getVisible())
{
// Skip invisible item pairs.
continue;
}
if (grab_items)
{
pairs_to_select.push_back(cur);
}
}
if (select_item)
{
pairs_to_select.push_back(item_pair);
}
for (pairs_iterator_t
iter = pairs_to_select.begin(),
iter_end = pairs_to_select.end();
iter != iter_end; ++iter)
{
item_pair_t* pair_to_select = *iter;
selectItemPair(pair_to_select, true);
}
if (!select_item)
{
// Item was already selected but there is a need to update last selected item and its border.
// Do it here to prevent extra mCommitOnSelectionChange in selectItemPair().
mSelectedItemPairs.remove(item_pair);
mSelectedItemPairs.push_back(item_pair);
mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1));
}
return;
}
if (!(mask & MASK_CONTROL) || !mMultipleSelection) resetSelection();
selectItemPair(item_pair, select_item);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment