use of spacegraph.space2d.widget.windo.Widget in project narchy by automenta.
the class Finger method on.
public synchronized Surface on(Surface root, float lx, float ly, short[] nextButtonDown) {
Fingering ff = this.fingering.get();
Fingering f0 = ff;
Surface touchedNext;
try {
this.pos.set(lx, ly);
arraycopy(this.buttonDown, 0, prevButtonDown, 0, buttonDown.length);
fill(this.buttonDown, false);
if (nextButtonDown != null) {
for (short s : nextButtonDown) {
if (// ignore -1 values
s > 0)
this.buttonDown[s - 1] = true;
}
for (int j = 0, jj = hitOnDown.length; j < jj; j++) {
if (!prevButtonDown[j] && buttonDown[j]) {
hitOnDown[j] = new v2(pos);
hitOnDownGlobal[j] = new v2(posGlobal);
}
}
} else {
Arrays.fill(hitOnDown, null);
}
if (ff == null || ff.escapes()) {
touchedNext = root.onTouch(this, nextButtonDown);
if (touchedNext instanceof Widget) {
if (!on((Widget) touchedNext))
touchedNext = null;
} else {
touchedNext = null;
}
} else {
touchedNext = null;
}
if (ff != null) {
if (!ff.update(this)) {
ff.stop(this);
ff = null;
}
}
for (int j = 0, jj = hitOnDown.length; j < jj; j++) {
if (!buttonDown[j] && hitOnDown[j] != null) {
// release
hitOnDown[j] = null;
}
}
if (touching != touchedNext && touching != null) {
touching.untouch();
touching = null;
}
} finally {
if (ff == null)
fingering.compareAndSet(f0, null);
}
return touchedNext;
}
Aggregations