use of com.cburch.draw.model.Handle in project logisim-evolution by reds-heig.
the class Selection method setSelected.
public void setSelected(Collection<CanvasObject> shapes, boolean value) {
if (value) {
List<CanvasObject> added;
added = new ArrayList<CanvasObject>(shapes.size());
for (CanvasObject shape : shapes) {
if (selected.add(shape)) {
added.add(shape);
}
}
if (!added.isEmpty()) {
fireChanged(SelectionEvent.ACTION_ADDED, added);
}
} else {
List<CanvasObject> removed;
removed = new ArrayList<CanvasObject>(shapes.size());
for (CanvasObject shape : shapes) {
if (selected.remove(shape)) {
suppressed.remove(shape);
Handle h = selectedHandle;
if (h != null && h.getObject() == shape)
setHandleSelected(null);
removed.add(shape);
}
}
if (!removed.isEmpty()) {
fireChanged(SelectionEvent.ACTION_REMOVED, removed);
}
}
}
use of com.cburch.draw.model.Handle in project logisim-evolution by reds-heig.
the class Selection method toggleSelected.
public void toggleSelected(Collection<CanvasObject> shapes) {
List<CanvasObject> added;
added = new ArrayList<CanvasObject>(shapes.size());
List<CanvasObject> removed;
removed = new ArrayList<CanvasObject>(shapes.size());
for (CanvasObject shape : shapes) {
if (selected.contains(shape)) {
selected.remove(shape);
suppressed.remove(shape);
Handle h = selectedHandle;
if (h != null && h.getObject() == shape)
setHandleSelected(null);
removed.add(shape);
} else {
selected.add(shape);
added.add(shape);
}
}
if (!removed.isEmpty()) {
fireChanged(SelectionEvent.ACTION_REMOVED, removed);
}
if (!added.isEmpty()) {
fireChanged(SelectionEvent.ACTION_ADDED, added);
}
}
use of com.cburch.draw.model.Handle in project logisim-evolution by reds-heig.
the class Selection method setHandleGesture.
public void setHandleGesture(HandleGesture gesture) {
HandleGesture g = curHandleGesture;
if (g != null)
suppressed.remove(g.getHandle().getObject());
Handle h = gesture.getHandle();
suppressed.put(h.getObject(), MOVING_HANDLE);
curHandleGesture = gesture;
}
use of com.cburch.draw.model.Handle in project logisim-evolution by reds-heig.
the class Curve method moveHandle.
@Override
public Handle moveHandle(HandleGesture gesture) {
Handle[] hs = getHandleArray(gesture);
Handle ret = null;
if (!hs[0].equals(p0)) {
p0 = hs[0].getLocation();
ret = hs[0];
}
if (!hs[1].equals(p1)) {
p1 = hs[1].getLocation();
ret = hs[1];
}
if (!hs[2].equals(p2)) {
p2 = hs[2].getLocation();
ret = hs[2];
}
bounds = CurveUtil.getBounds(toArray(p0), toArray(p1), toArray(p2));
return ret;
}
Aggregations