@needle-tools/engine 3.21.1-alpha.1 → 3.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this package will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [3.21.2] - 2023-10-23
8
+ - Change: Expose EventList subscriber count
9
+ - Change: `PointerEventArgs.use()` should not stop propagation
10
+
7
11
  ## [3.21.1-alpha] - 2023-10-20
8
12
  - Add: Multitouch support on `input` events, our EventSystem implementation now handles multitouch cases and is using the browser events directly and immediately (before events via `window` where deferred and hanlded during the engine update loop)
9
13
 
@@ -45958,25 +45958,31 @@ class qg {
45958
45958
  this.key = t;
45959
45959
  }
45960
45960
  }
45961
+ get listenerCount() {
45962
+ var A;
45963
+ return ((A = this.methods) == null ? void 0 : A.length) ?? 0;
45964
+ }
45961
45965
  invoke(...A) {
45962
- if (this._isInvoking) {
45963
- console.warn("Circular event invocation detected. Please check your event listeners for circular references.", this);
45964
- return;
45965
- }
45966
+ var e;
45967
+ if (this._isInvoking)
45968
+ return console.warn("Circular event invocation detected. Please check your event listeners for circular references.", this), !1;
45969
+ if (((e = this.methods) == null ? void 0 : e.length) <= 0)
45970
+ return !1;
45966
45971
  this._isInvoking = !0;
45967
45972
  try {
45968
- for (const e of this.methods)
45969
- e.invoke(...A);
45973
+ for (const t of this.methods)
45974
+ t.invoke(...A);
45970
45975
  if (typeof this.target == "object" && typeof this.key == "string") {
45971
- const e = this.target.dispatchEvent;
45972
- if (typeof e == "function") {
45973
- const t = new HM(this.key);
45974
- t.args = A, e.call(this.target, t);
45976
+ const t = this.target.dispatchEvent;
45977
+ if (typeof t == "function") {
45978
+ const g = new HM(this.key);
45979
+ g.args = A, t.call(this.target, g);
45975
45980
  }
45976
45981
  }
45977
45982
  } finally {
45978
45983
  this._isInvoking = !1;
45979
45984
  }
45985
+ return !0;
45980
45986
  }
45981
45987
  addEventListener(A) {
45982
45988
  return this.methods.push(new Lh(A, !0)), A;
@@ -61285,9 +61291,9 @@ const Us = class extends NA {
61285
61291
  * Propagate up in hiearchy and call the callback for each component that is possibly a handler
61286
61292
  */
61287
61293
  propagate(e, t, g) {
61288
- for (; !(t.used || (IA.foreachComponent(e, (I) => {
61294
+ for (; IA.foreachComponent(e, (I) => {
61289
61295
  g(I);
61290
- }, !1), !e.parent)); )
61296
+ }, !1), !!e.parent; )
61291
61297
  e = e.parent;
61292
61298
  }
61293
61299
  /**
@@ -64698,8 +64704,7 @@ class ma extends NA {
64698
64704
  bB && console.warn("Button Up", (t = this.animationTriggers) == null ? void 0 : t.highlightedTrigger, this.animator, this._isHovered), this.interactable && (this.transition == 3 && this.animationTriggers && this.animator ? this.animator.setTrigger(this._isHovered ? this.animationTriggers.highlightedTrigger : this.animationTriggers.normalTrigger) : this.transition === 1 && this.colors && ((g = this._image) == null || g.setState(this._isHovered ? "hovered" : "normal")));
64699
64705
  }
64700
64706
  onPointerClick(e) {
64701
- var t;
64702
- !this.interactable || e.pointerId === void 0 || e.pointerId !== 0 && this.context.input.getIsMouse(e.pointerId) || (bB && (console.warn("Button Click", this.onClick), Fi("CLICKED button " + this.name + " at " + this.context.time.frameCount)), (t = this.onClick) == null || t.invoke(), e.use());
64707
+ !this.interactable || e.pointerId === void 0 || e.pointerId !== 0 && this.context.input.getIsMouse(e.pointerId) || (bB && (console.warn("Button Click", this.onClick), Fi("CLICKED button " + this.name + " at " + this.context.time.frameCount)), this.onClick && this.onClick.listenerCount > 0 && (this.onClick.invoke(), e.use()));
64703
64708
  }
64704
64709
  set interactable(e) {
64705
64710
  this._interactable = e, this._image && (this._image.setInteractable(e), e ? this._image.setState("normal") : this._image.setState("disabled"));
@@ -45958,25 +45958,31 @@ class Es {
45958
45958
  this.key = i;
45959
45959
  }
45960
45960
  }
45961
+ get listenerCount() {
45962
+ var e;
45963
+ return ((e = this.methods) == null ? void 0 : e.length) ?? 0;
45964
+ }
45961
45965
  invoke(...e) {
45962
- if (this._isInvoking) {
45963
- console.warn("Circular event invocation detected. Please check your event listeners for circular references.", this);
45964
- return;
45965
- }
45966
+ var t;
45967
+ if (this._isInvoking)
45968
+ return console.warn("Circular event invocation detected. Please check your event listeners for circular references.", this), !1;
45969
+ if (((t = this.methods) == null ? void 0 : t.length) <= 0)
45970
+ return !1;
45966
45971
  this._isInvoking = !0;
45967
45972
  try {
45968
- for (const t of this.methods)
45969
- t.invoke(...e);
45973
+ for (const i of this.methods)
45974
+ i.invoke(...e);
45970
45975
  if (typeof this.target == "object" && typeof this.key == "string") {
45971
- const t = this.target.dispatchEvent;
45972
- if (typeof t == "function") {
45973
- const i = new T1(this.key);
45974
- i.args = e, t.call(this.target, i);
45976
+ const i = this.target.dispatchEvent;
45977
+ if (typeof i == "function") {
45978
+ const s = new T1(this.key);
45979
+ s.args = e, i.call(this.target, s);
45975
45980
  }
45976
45981
  }
45977
45982
  } finally {
45978
45983
  this._isInvoking = !1;
45979
45984
  }
45985
+ return !0;
45980
45986
  }
45981
45987
  addEventListener(e) {
45982
45988
  return this.methods.push(new lm(e, !0)), e;
@@ -61285,9 +61291,9 @@ const va = class extends Ie {
61285
61291
  * Propagate up in hiearchy and call the callback for each component that is possibly a handler
61286
61292
  */
61287
61293
  propagate(t, i, s) {
61288
- for (; !(i.used || (ne.foreachComponent(t, (r) => {
61294
+ for (; ne.foreachComponent(t, (r) => {
61289
61295
  s(r);
61290
- }, !1), !t.parent)); )
61296
+ }, !1), !!t.parent; )
61291
61297
  t = t.parent;
61292
61298
  }
61293
61299
  /**
@@ -64698,8 +64704,7 @@ class rh extends Ie {
64698
64704
  ud && console.warn("Button Up", (i = this.animationTriggers) == null ? void 0 : i.highlightedTrigger, this.animator, this._isHovered), this.interactable && (this.transition == 3 && this.animationTriggers && this.animator ? this.animator.setTrigger(this._isHovered ? this.animationTriggers.highlightedTrigger : this.animationTriggers.normalTrigger) : this.transition === 1 && this.colors && ((s = this._image) == null || s.setState(this._isHovered ? "hovered" : "normal")));
64699
64705
  }
64700
64706
  onPointerClick(t) {
64701
- var i;
64702
- !this.interactable || t.pointerId === void 0 || t.pointerId !== 0 && this.context.input.getIsMouse(t.pointerId) || (ud && (console.warn("Button Click", this.onClick), _n("CLICKED button " + this.name + " at " + this.context.time.frameCount)), (i = this.onClick) == null || i.invoke(), t.use());
64707
+ !this.interactable || t.pointerId === void 0 || t.pointerId !== 0 && this.context.input.getIsMouse(t.pointerId) || (ud && (console.warn("Button Click", this.onClick), _n("CLICKED button " + this.name + " at " + this.context.time.frameCount)), this.onClick && this.onClick.listenerCount > 0 && (this.onClick.invoke(), t.use()));
64703
64708
  }
64704
64709
  set interactable(t) {
64705
64710
  this._interactable = t, this._image && (this._image.setInteractable(t), t ? this._image.setState("normal") : this._image.setState("disabled"));