X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=LogicUI%2Fsrc%2Fera%2Fmi%2Fwires%2Fgui%2FGUIWire.java;h=1de3e9ef16dd2311de245142337d891dc079a625;hb=f58c5654c2ea4f3c66768f8f80aeb96bd40694b5;hp=7cfa796a3c132ad48dbddc4bad5d4c0e68d5bc4a;hpb=9c1a10fc2952c13889c28d52a7a3d23ffc5ed618;p=Mograsim.git diff --git a/LogicUI/src/era/mi/wires/gui/GUIWire.java b/LogicUI/src/era/mi/wires/gui/GUIWire.java index 7cfa796a..1de3e9ef 100644 --- a/LogicUI/src/era/mi/wires/gui/GUIWire.java +++ b/LogicUI/src/era/mi/wires/gui/GUIWire.java @@ -12,7 +12,7 @@ public class GUIWire private final WireArray wa; private final double[] path; - public GUIWire(BasicGUIComponent component1, int component1ConnectionIndex, Point component1Pos, BasicGUIComponent component2, int component2ConnectionIndex, Point component2Pos, Point... path) + public GUIWire(Runnable redraw, BasicGUIComponent component1, int component1ConnectionIndex, Point component1Pos, BasicGUIComponent component2, int component2ConnectionIndex, Point component2Pos, Point... path) { this.wa = component1.getConnectedWireArray(component1ConnectionIndex); if(!Objects.equals(wa, component2.getConnectedWireArray(component2ConnectionIndex))) @@ -29,6 +29,8 @@ public class GUIWire Point component2ConnectionPoint = component2.getWireArrayConnectionPoint(component2ConnectionIndex); this.path[this.path.length - 2] = component2Pos.x + component2ConnectionPoint.x; this.path[this.path.length - 1] = component2Pos.y + component2ConnectionPoint.y; + + wa.addObserver((initiator, oldValues) -> redraw.run()); } public void render(GeneralGC gc)