@@ -126,6 +126,8 @@
|
|
126
126
|
showBalloonMessage("CLICKED button " + this.name + " at " + this.context.time.frameCount);
|
127
127
|
}
|
128
128
|
|
129
|
+
// TODO: we can not *always* use the event right now because the hotspot sample is relying on onPointerClick on a parent object
|
130
|
+
// and it's not using the button
|
129
131
|
if (this.onClick && this.onClick.listenerCount > 0) {
|
130
132
|
this.onClick.invoke();
|
131
133
|
args.use();
|
@@ -609,5 +609,10 @@
|
|
609
609
|
if (value.isVector4 || value.isVector3 || value.isVector2 || value.isQuaternion || value.isEuler) {
|
610
610
|
return value.clone();
|
611
611
|
}
|
612
|
+
else if(value.isEventList === true){
|
613
|
+
// create a new instance of the object
|
614
|
+
const copy = new value.constructor();
|
615
|
+
return copy;
|
616
|
+
}
|
612
617
|
}
|
613
618
|
}
|
@@ -572,12 +572,21 @@
|
|
572
572
|
}
|
573
573
|
// moveEvent?: Event;
|
574
574
|
private onMove(evt: NEPointerEvent) {
|
575
|
-
|
575
|
+
// when we get a pointer move event then the click state needs to be reset
|
576
|
+
// this happens for example if we use touch emulation in chrome and click on an object without using the mouse
|
577
|
+
// since the EventSystem queries `isPointerClicked` and we get an event for onMove we would then falsely emit
|
578
|
+
// two onPointerClick events for one click
|
579
|
+
const index = evt.button;
|
580
|
+
this._pointerClick[index] = false;
|
581
|
+
this._pointerDoubleClick[index] = false;
|
582
|
+
|
583
|
+
const isDown = this.getPointerPressed(index);
|
576
584
|
if (isDown === false && !this.isInRect(evt)) return;
|
577
585
|
if (evt.pointerType === PointerType.Touch && !isDown) return;
|
578
|
-
if (debug) console.log(evt.pointerType, "MOVE",
|
586
|
+
if (debug) console.log(evt.pointerType, "MOVE", index);
|
587
|
+
|
579
588
|
this.updatePointerPosition(evt);
|
580
|
-
this.setPointerStateT(
|
589
|
+
this.setPointerStateT(index, this._pointerEvent, evt.source);
|
581
590
|
this.onDispatchEvent(evt);
|
582
591
|
}
|
583
592
|
private onUp(evt: NEPointerEvent) {
|
@@ -764,11 +764,11 @@
|
|
764
764
|
{
|
765
765
|
const ball = shape as Ball;
|
766
766
|
const sc = col as ISphereCollider;
|
767
|
-
const changed = ball.radius !== sc.radius;
|
768
767
|
const obj = col.gameObject;
|
769
768
|
const scale = getWorldScale(obj, this._tempPosition).multiplyScalar(sc.radius);
|
770
|
-
|
771
|
-
ball.radius
|
769
|
+
const radius = sc.radius * Math.abs(scale.x);
|
770
|
+
const changed = ball.radius !== radius;
|
771
|
+
ball.radius = radius;
|
772
772
|
if (changed)
|
773
773
|
collider.setShape(ball);
|
774
774
|
break;
|
@@ -29,6 +29,9 @@
|
|
29
29
|
// UnityEvent is emitted as EventList
|
30
30
|
export class EventList {
|
31
31
|
|
32
|
+
/** checked during instantiate to create a new instance */
|
33
|
+
readonly isEventList = true;
|
34
|
+
|
32
35
|
private target?: object;
|
33
36
|
private key?: string;
|
34
37
|
|
@@ -53,7 +56,10 @@
|
|
53
56
|
}
|
54
57
|
}
|
55
58
|
|
59
|
+
/** How many callback methods are subscribed to this event */
|
56
60
|
get listenerCount() { return this.methods?.length ?? 0; }
|
61
|
+
/** If the event is currently being invoked */
|
62
|
+
get isInvoking() { return this._isInvoking; }
|
57
63
|
|
58
64
|
private _isInvoking: boolean = false;
|
59
65
|
|
@@ -430,8 +430,14 @@
|
|
430
430
|
while (true) {
|
431
431
|
// Propagate up the hierarchy
|
432
432
|
|
433
|
+
if(_args.used) return;
|
434
|
+
|
433
435
|
GameObject.foreachComponent(object, comp => {
|
436
|
+
// TODO: implement Stop Immediate Propagation
|
437
|
+
|
434
438
|
onComponent(comp);
|
439
|
+
// return undefined to continue iterating
|
440
|
+
return undefined;
|
435
441
|
}, false);
|
436
442
|
|
437
443
|
if (!object.parent) break;
|