X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model.editor%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Feditor%2Fhandles%2FWirePointHandle.java;h=4c0b9a31ecf3b4f22709b640f77da5cb9736b2c3;hb=148a58630b38b30d4d24a21e3f55c357f5b4d0bc;hp=24575797bf40e538a8dd88abece335369e2ae2da;hpb=a393b0a2a9899707af54c9ee77a01f28ac967bd1;p=Mograsim.git diff --git a/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/WirePointHandle.java b/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/WirePointHandle.java index 24575797..4c0b9a31 100644 --- a/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/WirePointHandle.java +++ b/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/WirePointHandle.java @@ -11,14 +11,16 @@ import net.mograsim.logic.model.model.wires.GUIWire; public class WirePointHandle extends Handle { private final static int END_OFFSET = 4; + private final HandleManager manager; private boolean selected = false; public final GUIWire parent; - + private int pointIndex; - public WirePointHandle(GUIWire parent, int pointIndex) + public WirePointHandle(HandleManager manager, GUIWire parent, int pointIndex) { - super(); + super(3); + this.manager = manager; this.parent = parent; this.pointIndex = pointIndex; setSize(END_OFFSET, END_OFFSET); @@ -30,8 +32,9 @@ public class WirePointHandle extends Handle { Point p = parent.getPathPoint(pointIndex); moveTo(p.x, p.y); + callRedrawListeners(); } - + @Override public void render(GeneralGC gc) { @@ -45,7 +48,7 @@ public class WirePointHandle extends Handle { parent.setPathPoint(new Point(x, y), pointIndex); } - + @Override public void onSelect() { @@ -59,13 +62,13 @@ public class WirePointHandle extends Handle selected = false; callRedrawListeners(); } - + @Override public void reqDelete() { - parent.removePathPoint(pointIndex); + manager.destroyWirePointHandle(parent, this); } - + @Override public HandleType getType() { @@ -74,6 +77,7 @@ public class WirePointHandle extends Handle /** * Sets the index of the {@link Point} within the parent {@link Wire}s path that is controlled by this handle + * * @param index Index of the Point in the Wires path. * @throws IndexOutOfBoundsException */