if ((e.getModifiers() & InputEvent.SHIFT_MASK) == 0) {
setState(proj, MOVING);
proj.repaintCanvas();
return;
} else {
Action act = SelectionActions.drop(sel, in_sel);
if (act != null) {
proj.doAction(act);
}
}
}
// if the user clicks into a component outside selection, user
// wants to add/reset selection
Collection<Component> clicked = circuit.getAllContaining(start, g);
if (!clicked.isEmpty()) {
if ((e.getModifiers() & InputEvent.SHIFT_MASK) == 0) {
if (sel.getComponentsContaining(start).isEmpty()) {
Action act = SelectionActions.dropAll(sel);
if (act != null) {
proj.doAction(act);
}
}
}
for (Component comp : clicked) {
if (!in_sel.contains(comp)) {
sel.add(comp);
}
}
setState(proj, MOVING);
proj.repaintCanvas();
return;
}
// The user clicked on the background. This is a rectangular
// selection (maybe with the shift key down).
if ((e.getModifiers() & InputEvent.SHIFT_MASK) == 0) {
Action act = SelectionActions.dropAll(sel);
if (act != null) {
proj.doAction(act);
}
}
setState(proj, RECT_SELECT);