fix ctrl selection

This commit is contained in:
bancika
2013-04-29 10:30:58 +00:00
parent bc3875ecbf
commit bdfa255439
@@ -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,6 +612,9 @@ 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>>();