Commit 1807b8a2 authored by Tuukka Lehtonen's avatar Tuukka Lehtonen
Browse files

Don't clear diagram selection on 1st button click when shift/ctrl down

This makes the UI more uniform with e.g. PowerPoint and Inkscape and
makes it harder to lose your selection with inaccurate clicks.

gitlab #702
parent ce92edf8
......@@ -442,6 +442,7 @@ public class PointerInteractor extends AbstractDiagramParticipant {
boolean popupWasVisible = wasPopupJustClosed(me);
boolean noModifiers = !anyModifierPressed(me);
boolean isShiftPressed = me.hasAllModifiers(MouseEvent.SHIFT_MASK);
boolean isCtrlPressed = me.hasAllModifiers(MouseEvent.CTRL_MASK);
assertDependencies();
......@@ -453,7 +454,7 @@ public class PointerInteractor extends AbstractDiagramParticipant {
req.pickSorter = PickRequest.PickSorter.connectionSorter(pickSorter, req.pickArea.getBounds2D().getCenterX(), req.pickArea.getBounds2D().getCenterY());
//req.pickSorter = PickRequest.PickSorter.CONNECTIONS_LAST;
List<IElement> pickables = new ArrayList<IElement>();
List<IElement> pickables = new ArrayList<>();
pickContext.pick(diagram, req, pickables);
Set<IElement> currentSelection = selection.getSelection(selectionId);
......@@ -461,8 +462,8 @@ public class PointerInteractor extends AbstractDiagramParticipant {
// Clear selection
if (pickables.isEmpty()) {
if (!popupWasVisible) {
// Only clear selection on left button clicks.
if (isLeft) {
// Only clear selection on left button clicks without ctrl/shift modifiers
if (isLeft && !(isShiftPressed || isCtrlPressed)) {
selection.clear(selectionId);
}
}
......@@ -474,7 +475,7 @@ public class PointerInteractor extends AbstractDiagramParticipant {
}
// Toggle select
if ((me.stateMask & MouseEvent.CTRL_MASK) != 0) {
if (isCtrlPressed) {
if (isLeft) {
/*
* - If the mouse points to an object not in the selection, add it to selection.
......@@ -500,7 +501,7 @@ public class PointerInteractor extends AbstractDiagramParticipant {
}
return false;
}
boolean result = false;
// Click Select
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment