import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
import net.mograsim.logic.model.editor.states.EditorState;
+import net.mograsim.logic.model.model.ViewModelModifiable;
import net.mograsim.logic.model.model.wires.GUIWire;
-import net.mograsim.logic.model.model.wires.GUIWire.PathChangedListener;
-public class WireHandle extends Handle implements PathChangedListener
+public class WireHandle extends Handle
{
private boolean selected = false;
private final static double WIDTH = 2.0;
private final static double WIDTH_SQUARED = WIDTH * WIDTH;
+ private final ViewModelModifiable model;
public final GUIWire parent;
- public WireHandle(GUIWire parent)
+ public WireHandle(ViewModelModifiable model, GUIWire parent)
{
+ super(5);
+ this.model = model;
this.parent = parent;
- parent.addPathChangedListener(this);
+ parent.addPathChangedListener(c -> updateBounds());
updateBounds();
}
void destroy()
{
super.destroy();
- parent.removePathChangedListener(this);
+ parent.removePathChangedListener(c -> updateBounds());
}
public void updateBounds()
@Override
public void reqDelete()
{
- parent.destroy();
+ model.destroyWire(parent);
}
@Override
{
return HandleType.WIRE;
}
-
- @Override
- public void pathChanged(GUIWire wire, int diff)
- {
- updateBounds();
- }
}