From: Fabian Stemmler Date: Mon, 15 Jul 2019 16:19:15 +0000 (+0200) Subject: Merge branch 'development' of X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=6e1902e006401ddea190178595bf6ae6357e74ad;p=Mograsim.git Merge branch 'development' of https://gitlab.lrz.de/lrr-tum/students/eragp-misim-2019 into development # Conflicts: # net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/HandleManager.java --- 6e1902e006401ddea190178595bf6ae6357e74ad diff --cc net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/HandleManager.java index e4fb3142,c5e06a54..58e1f6cb --- 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 @@@ -114,19 -115,24 +115,24 @@@ public class HandleManage private void registerWire(GUIWire wire) { - wire.addPathChangedListener((w, diff) -> + Point[] path = wire.getPath(); + AtomicInteger oldLength = new AtomicInteger(path == null ? 0 : path.length); + wire.addPathChangedListener(w -> { + Point[] newPath = w.getPath(); + int newLength = newPath == null ? 0 : newPath.length; + int diff = oldLength.getAndSet(newLength) - newLength; - if(diff != 0) + if (diff != 0) { - if(diff > 0) + if (diff > 0) { - for(int i = 0; i < diff; i++) + for (int i = 0; i < diff; i++) addWirePointHandle(w); } - + List wpHandles = pointHandlesPerWire.get(w); int size = wpHandles.size(); - for(int i = 0; i < size; i++) + for (int i = 0; i < size; i++) { wpHandles.get(i).setIndex(i); } @@@ -346,7 -352,7 +352,7 @@@ entryState.clicked(clicked, stateMask); } -- private boolean click(Collection handles, Point clicked, EditorState state, int stateMask) ++ private static boolean click(Collection handles, Point clicked, EditorState state, int stateMask) { for (Handle h : handles) if (h.click(clicked.x, clicked.y, stateMask, state)) diff --cc net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/WireHandle.java index a5e97d4c,0e6c4555..199df99c --- a/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/WireHandle.java +++ b/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/WireHandle.java @@@ -22,10 -21,10 +21,10 @@@ public class WireHandle extends Handl public WireHandle(GUIWire parent) { this.parent = parent; - parent.addPathChangedListener(this); + parent.addPathChangedListener(c -> updateBounds()); updateBounds(); } - + @Override void destroy() {