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 ->
{
- if(diff != 0)
+ 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)
{
- for(int i = 0; i < diff; i++)
+ for (int i = 0; i < diff; i++)
addWirePointHandle(w);
}
-
+
List<WirePointHandle> 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);
}
entryState.clicked(clicked, stateMask);
}
-- private boolean click(Collection<? extends Handle> handles, Point clicked, EditorState state, int stateMask)
++ private static boolean click(Collection<? extends Handle> handles, Point clicked, EditorState state, int stateMask)
{
for (Handle h : handles)
if (h.click(clicked.x, clicked.y, stateMask, state))