mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
fix ctrl selection
This commit is contained in:
+10
-7
@@ -578,25 +578,25 @@ public class Presenter implements IPlugInPort {
|
|||||||
newSelection.clear();
|
newSelection.clear();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
IDIYComponent<?> component = components.get(0);
|
IDIYComponent<?> topComponent = components.get(0);
|
||||||
// If ctrl is pressed just toggle the component under mouse
|
// If ctrl is pressed just toggle the component under mouse
|
||||||
// cursor.
|
// cursor.
|
||||||
if (ctrlDown) {
|
if (ctrlDown) {
|
||||||
if (newSelection.contains(component)) {
|
if (newSelection.contains(topComponent)) {
|
||||||
newSelection
|
newSelection
|
||||||
.removeAll(findAllGroupedComponents(component));
|
.removeAll(findAllGroupedComponents(topComponent));
|
||||||
} else {
|
} else {
|
||||||
newSelection
|
newSelection
|
||||||
.addAll(findAllGroupedComponents(component));
|
.addAll(findAllGroupedComponents(topComponent));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Otherwise just select that one component.
|
// Otherwise just select that one component.
|
||||||
if (button == BUTTON1
|
if (button == BUTTON1
|
||||||
|| !selectedComponents.contains(component)) {
|
|| !newSelection.contains(topComponent)) {
|
||||||
newSelection.clear();
|
newSelection.clear();
|
||||||
}
|
}
|
||||||
newSelection
|
newSelection
|
||||||
.addAll(findAllGroupedComponents(component));
|
.addAll(findAllGroupedComponents(topComponent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateSelection(newSelection);
|
updateSelection(newSelection);
|
||||||
@@ -612,8 +612,11 @@ public class Presenter implements IPlugInPort {
|
|||||||
@Override
|
@Override
|
||||||
public boolean keyPressed(int key, boolean ctrlDown, boolean shiftDown,
|
public boolean keyPressed(int key, boolean ctrlDown, boolean shiftDown,
|
||||||
boolean altDown) {
|
boolean altDown) {
|
||||||
|
if (key != VK_DOWN && key != VK_LEFT && key != VK_UP && key != VK_RIGHT) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
LOG.debug(String.format("keyPressed(%s, %s, %s, %s)", key, ctrlDown,
|
LOG.debug(String.format("keyPressed(%s, %s, %s, %s)", key, ctrlDown,
|
||||||
shiftDown, altDown));
|
shiftDown, altDown));
|
||||||
Map<IDIYComponent<?>, Set<Integer>> controlPointMap = new HashMap<IDIYComponent<?>, Set<Integer>>();
|
Map<IDIYComponent<?>, Set<Integer>> controlPointMap = new HashMap<IDIYComponent<?>, Set<Integer>>();
|
||||||
// If there aren't any control points, try to add all the selected
|
// If there aren't any control points, try to add all the selected
|
||||||
// components with all their control points. That will allow the
|
// components with all their control points. That will allow the
|
||||||
|
|||||||
Reference in New Issue
Block a user