{
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)
void destroyWirePointHandle(GUIWire owner, WirePointHandle h)
{
- List<WirePointHandle> handles = pointHandlesPerWire.get(owner);
- int pointIndex = handles.indexOf(h);
- handles.remove(pointIndex);
- removeHandle(h);
- owner.removePathPoint(pointIndex);
+ if (pointHandlesPerWire.containsKey(owner))
+ {
+ List<WirePointHandle> handles = pointHandlesPerWire.get(owner);
+ int pointIndex = handles.indexOf(h);
+ handles.remove(pointIndex);
+ removeHandle(h);
+ owner.removePathPoint(pointIndex);
+ }
}
private void removeWirePointHandles(GUIWire owner)
{
Point p = parent.getPathPoint(pointIndex);
moveTo(p.x, p.y);
+ callRedrawListeners();
}
@Override
super(parent, style, editor.toBeEdited.submodel);
handles = editor.handleManager.getHandles();
- editor.handleManager.addHandleAddedListener(h -> h.addRedrawListener(this::redrawThreadsafe));
+ editor.handleManager.addHandleAddedListener(h ->
+ {
+ redrawThreadsafe();
+ h.addRedrawListener(this::redrawThreadsafe);
+ });
// TODO: Is this even necessary? The Handle should be finalized by the gc
- editor.handleManager.addHandleRemovedListener(h -> h.removeRedrawListener(this::redrawThreadsafe));
+ editor.handleManager.addHandleRemovedListener(h ->
+ {
+ redrawThreadsafe();
+ h.removeRedrawListener(this::redrawThreadsafe);
+ });
addZoomedRenderer(gc ->
{
System.arraycopy(oldPath, index, path, index + 1, oldPath.length - index);
path[index] = pointCopy(p);
}
+ recalculateEffectivePath();
+ callPathChangedListeners();
}
public void removePathPoint(int index)
if (index < oldPath.length - 1)
System.arraycopy(oldPath, index + 1, path, index, oldPath.length - index - 1);
}
+ recalculateEffectivePath();
+ callPathChangedListeners();
}
public double[] getEffectivePath()