X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model.editor%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Feditor%2Fhandles%2FHandleManager.java;h=ee755f92b935aca80f9fdb3576d5375e4b2d0bb1;hb=d43a60248809b835d63a7f8cc50a3346902e790e;hp=58e1f6cb94da8f593e97167e873ebb68bf477c82;hpb=6e1902e006401ddea190178595bf6ae6357e74ad;p=Mograsim.git diff --git a/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/HandleManager.java b/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/HandleManager.java index 58e1f6cb..ee755f92 100644 --- a/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/HandleManager.java +++ b/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/HandleManager.java @@ -91,7 +91,7 @@ public class HandleManager registerInterfaceComponent(interfaceComp); comps.forEach(c -> registerComponent(c)); - model.getWires().forEach(w -> registerWire(w)); + model.getWiresByName().values().forEach(w -> registerWire(w)); addHandle(cornerHandle = new CornerHandle(editor.toBeEdited)); } } @@ -121,7 +121,7 @@ public class HandleManager { Point[] newPath = w.getPath(); int newLength = newPath == null ? 0 : newPath.length; - int diff = oldLength.getAndSet(newLength) - newLength; + int diff = newLength - oldLength.getAndSet(newLength); if (diff != 0) { if (diff > 0) @@ -216,11 +216,14 @@ public class HandleManager void destroyWirePointHandle(GUIWire owner, WirePointHandle h) { - List handles = pointHandlesPerWire.get(owner); - int pointIndex = handles.indexOf(h); - handles.remove(pointIndex); - removeHandle(h); - owner.removePathPoint(pointIndex); + if (pointHandlesPerWire.containsKey(owner)) + { + List handles = pointHandlesPerWire.get(owner); + int pointIndex = handles.indexOf(h); + handles.remove(pointIndex); + removeHandle(h); + owner.removePathPoint(pointIndex); + } } private void removeWirePointHandles(GUIWire owner)