Skip to content

Commit e240a1d

Browse files
committed
Allow true multiselection and deselection of already selected elements, closes #47
1 parent 6cc4bda commit e240a1d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/DiagramEditor/Diagrams/Diagram.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ private void AddCreatedShape()
13251325
private void SelectElements(AbsoluteMouseEventArgs e)
13261326
{
13271327
DiagramElement firstElement = null;
1328-
bool multiSelection = (Control.ModifierKeys == Keys.Control);
1328+
bool multiSelection = (Control.ModifierKeys == Keys.Control || Control.ModifierKeys == Keys.Shift);
13291329

13301330
foreach (DiagramElement element in GetElementsInDisplayOrder())
13311331
{
@@ -1334,8 +1334,12 @@ private void SelectElements(AbsoluteMouseEventArgs e)
13341334
if (e.Handled && firstElement == null)
13351335
{
13361336
firstElement = element;
1337-
if (isSelected)
1338-
multiSelection = true;
1337+
1338+
// allow to deselect elements when in multiselection
1339+
if(multiSelection && isSelected)
1340+
{
1341+
element.IsSelected = false;
1342+
}
13391343
}
13401344
}
13411345

0 commit comments

Comments
 (0)