}\r
private void addWire(BasicGUIComponent component1, int component1ConnectionIndex, BasicGUIComponent component2, int component2ConnectionIndex, Point... path)\r
{\r
- wires.add(new GUIWire(component1, component1ConnectionIndex, componentPositions.get(component1), component2, component2ConnectionIndex, componentPositions.get(component2), path));\r
+ wires.add(new GUIWire(canvas::redrawThreadsafe, component1, component1ConnectionIndex, componentPositions.get(component1), component2, component2ConnectionIndex, componentPositions.get(component2), path));\r
}\r
private void drawComponent(GeneralGC gc, BasicGUIComponent component)\r
{\r
private final WireArray wa;\r
private final double[] path;\r
\r
- public GUIWire(BasicGUIComponent component1, int component1ConnectionIndex, Point component1Pos, BasicGUIComponent component2, int component2ConnectionIndex, Point component2Pos, Point... path)\r
+ public GUIWire(Runnable redraw, BasicGUIComponent component1, int component1ConnectionIndex, Point component1Pos, BasicGUIComponent component2, int component2ConnectionIndex, Point component2Pos, Point... path)\r
{\r
this.wa = component1.getConnectedWireArray(component1ConnectionIndex);\r
if(!Objects.equals(wa, component2.getConnectedWireArray(component2ConnectionIndex)))\r
Point component2ConnectionPoint = component2.getWireArrayConnectionPoint(component2ConnectionIndex);\r
this.path[this.path.length - 2] = component2Pos.x + component2ConnectionPoint.x;\r
this.path[this.path.length - 1] = component2Pos.y + component2ConnectionPoint.y;\r
+\r
+ wa.addObserver((initiator, oldValues) -> redraw.run());\r
}\r
\r
public void render(GeneralGC gc)\r