projects
/
Mograsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed & cleaned up GUIWire:
[Mograsim.git]
/
net.mograsim.logic.model.editor
/
src
/
net
/
mograsim
/
logic
/
model
/
editor
/
handles
/
HandleManager.java
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
91b0e3b
..
c5e06a5
100644
(file)
--- 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
@@
-8,6
+8,7
@@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@@
-114,8
+115,13
@@
public class HandleManager
private void registerWire(GUIWire wire)
{
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)
@@
-134,9
+140,9
@@
public class HandleManager
pointHandlesPerWire.get(w).forEach(h -> h.updatePos());
});
addWireHandle(wire);
pointHandlesPerWire.get(w).forEach(h -> h.updatePos());
});
addWireHandle(wire);
- if (
wire.getPath()
== null)
+ if (
path
== null)
return;
return;
- for (int i = 0; i <
wire.getPath()
.length; i++)
+ for (int i = 0; i <
path
.length; i++)
{
addWirePointHandle(wire);
}
{
addWirePointHandle(wire);
}