@needle-tools/engine 3.28.4-beta → 3.28.5-beta

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,7 +4,7 @@ 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.28.4-beta] - 2023-12-22
7
+ ## [3.28.5-beta] - 2023-12-22
8
8
  - Fix: WebXRController falsely triggering click in EventSystem
9
9
 
10
10
  ## [3.28.3-beta] - 2023-12-21
@@ -61912,18 +61912,15 @@ const vs = class extends NA {
61912
61912
  if (e.set(g, null), s)
61913
61913
  for (const C of this.pressedByID.keys()) {
61914
61914
  const a = this.pressedByID[C];
61915
- a.obj === s && a.handler && ((n = a.handler.onPointerUp) == null || n.call(a.handler, o), this.pressedByID.delete(C));
61915
+ a && a.obj === s && a.handler && ((n = a.handler.onPointerUp) == null || n.call(a.handler, o), this.pressedByID.delete(C));
61916
61916
  }
61917
61917
  });
61918
61918
  const t = new Yo();
61919
61919
  this._selectUpdateFn ?? (this._selectUpdateFn = (g) => {
61920
61920
  var s;
61921
61921
  t.ray = g.getRay();
61922
- const I = this.performRaycast(t);
61923
- if (!I)
61924
- return;
61925
- const o = new ia(this.context.input);
61926
- o.inputSource = g, o.pointerId = ((s = g.input) == null ? void 0 : s.handedness) === "right" ? 0 : 1, o.isDown = g.selectionDown, o.isUp = g.selectionUp, o.isPressed = g.selectionPressed, o.isClicked = !1, this.handleIntersections(I, o);
61922
+ const I = this.performRaycast(t) ?? [], o = new ia(this.context.input);
61923
+ o.inputSource = g, o.pointerId = ((s = g.input) == null ? void 0 : s.handedness) === "right" ? 0 : 1, o.isDown = g.selectionDown, o.isUp = g.selectionUp, o.isPressed = g.selectionPressed, o.isClicked = !1, this.handleIntersections(o.pointerId, I, o);
61927
61924
  }), ui.addEventListener(XC.SelectStart, this._selectStartFn), ui.addEventListener(XC.SelectEnd, this._selectEndFn), ui.addEventListener(XC.Update, this._selectUpdateFn), this._handleInputFn = this.onPointerEvent.bind(this), this.context.input.addEventListener(Ni.PointerDown, this._handleInputFn), this.context.input.addEventListener(Ni.PointerUp, this._handleInputFn), this.context.input.addEventListener(Ni.PointerMove, this._handleInputFn);
61928
61925
  }
61929
61926
  onDisable() {
@@ -61951,17 +61948,7 @@ const vs = class extends NA {
61951
61948
  args: g,
61952
61949
  hasActiveUI: this.currentActiveMeshUIComponents.length > 0
61953
61950
  };
61954
- if (this.dispatchEvent(new CustomEvent("BeforeHandleInput", { detail: s })), !this.handleIntersections(o, g)) {
61955
- const n = this.hoveredByID.get(t);
61956
- if (n && this.triggerOnExit(n.obj, n.data), this.hoveredByID.delete(t), g.isUp) {
61957
- const C = this.pressedByID.get(t);
61958
- C == null || C.handlers.forEach((a) => {
61959
- var B;
61960
- return (B = a.onPointerUp) == null ? void 0 : B.call(a, g);
61961
- }), this.pressedByID.delete(t);
61962
- }
61963
- }
61964
- this.dispatchEvent(new CustomEvent("AfterHandleInput", { detail: s }));
61951
+ this.dispatchEvent(new CustomEvent("BeforeHandleInput", { detail: s })), this.handleIntersections(t, o, g), this.dispatchEvent(new CustomEvent("AfterHandleInput", { detail: s }));
61965
61952
  }
61966
61953
  /** the raycast filter is always overriden */
61967
61954
  performRaycast(e) {
@@ -61976,15 +61963,22 @@ const vs = class extends NA {
61976
61963
  }
61977
61964
  return this._sortedHits.sort((t, g) => t.distance - g.distance), this._sortedHits;
61978
61965
  }
61979
- // Handles first hit that has a handler, the rest is ignored
61980
- handleIntersections(e, t) {
61981
- if (!e || e.length <= 0)
61982
- return !1;
61983
- e = this.sortCandidates(e);
61984
- for (const g of e) {
61985
- const { object: I } = g;
61986
- if (t.point = g.point, t.normal = g.normal, t.face = g.face, t.distance = g.distance, t.instanceId = g.instanceId, this.handleEventOnObject(I, t))
61987
- return !0;
61966
+ handleIntersections(e, t, g) {
61967
+ if (t != null && t.length) {
61968
+ t = this.sortCandidates(t);
61969
+ for (const o of t) {
61970
+ const { object: s } = o;
61971
+ if (g.point = o.point, g.normal = o.normal, g.face = o.face, g.distance = o.distance, g.instanceId = o.instanceId, this.handleEventOnObject(s, g))
61972
+ return !0;
61973
+ }
61974
+ }
61975
+ const I = this.hoveredByID.get(e);
61976
+ if (I && this.triggerOnExit(I.obj, I.data), this.hoveredByID.delete(e), g.isUp) {
61977
+ const o = this.pressedByID.get(e);
61978
+ o == null || o.handlers.forEach((s) => {
61979
+ var n;
61980
+ return (n = s.onPointerUp) == null ? void 0 : n.call(s, g);
61981
+ }), this.pressedByID.delete(e);
61988
61982
  }
61989
61983
  return !1;
61990
61984
  }
@@ -61912,18 +61912,15 @@ const Sa = class extends Ie {
61912
61912
  if (t.set(s, null), a)
61913
61913
  for (const l of this.pressedByID.keys()) {
61914
61914
  const u = this.pressedByID[l];
61915
- u.obj === a && u.handler && ((c = u.handler.onPointerUp) == null || c.call(u.handler, o), this.pressedByID.delete(l));
61915
+ u && u.obj === a && u.handler && ((c = u.handler.onPointerUp) == null || c.call(u.handler, o), this.pressedByID.delete(l));
61916
61916
  }
61917
61917
  });
61918
61918
  const i = new Ro();
61919
61919
  this._selectUpdateFn ?? (this._selectUpdateFn = (s) => {
61920
61920
  var a;
61921
61921
  i.ray = s.getRay();
61922
- const r = this.performRaycast(i);
61923
- if (!r)
61924
- return;
61925
- const o = new Ul(this.context.input);
61926
- o.inputSource = s, o.pointerId = ((a = s.input) == null ? void 0 : a.handedness) === "right" ? 0 : 1, o.isDown = s.selectionDown, o.isUp = s.selectionUp, o.isPressed = s.selectionPressed, o.isClicked = !1, this.handleIntersections(r, o);
61922
+ const r = this.performRaycast(i) ?? [], o = new Ul(this.context.input);
61923
+ o.inputSource = s, o.pointerId = ((a = s.input) == null ? void 0 : a.handedness) === "right" ? 0 : 1, o.isDown = s.selectionDown, o.isUp = s.selectionUp, o.isPressed = s.selectionPressed, o.isClicked = !1, this.handleIntersections(o.pointerId, r, o);
61927
61924
  }), un.addEventListener(Dl.SelectStart, this._selectStartFn), un.addEventListener(Dl.SelectEnd, this._selectEndFn), un.addEventListener(Dl.Update, this._selectUpdateFn), this._handleInputFn = this.onPointerEvent.bind(this), this.context.input.addEventListener(wn.PointerDown, this._handleInputFn), this.context.input.addEventListener(wn.PointerUp, this._handleInputFn), this.context.input.addEventListener(wn.PointerMove, this._handleInputFn);
61928
61925
  }
61929
61926
  onDisable() {
@@ -61951,17 +61948,7 @@ const Sa = class extends Ie {
61951
61948
  args: s,
61952
61949
  hasActiveUI: this.currentActiveMeshUIComponents.length > 0
61953
61950
  };
61954
- if (this.dispatchEvent(new CustomEvent("BeforeHandleInput", { detail: a })), !this.handleIntersections(o, s)) {
61955
- const c = this.hoveredByID.get(i);
61956
- if (c && this.triggerOnExit(c.obj, c.data), this.hoveredByID.delete(i), s.isUp) {
61957
- const l = this.pressedByID.get(i);
61958
- l == null || l.handlers.forEach((u) => {
61959
- var d;
61960
- return (d = u.onPointerUp) == null ? void 0 : d.call(u, s);
61961
- }), this.pressedByID.delete(i);
61962
- }
61963
- }
61964
- this.dispatchEvent(new CustomEvent("AfterHandleInput", { detail: a }));
61951
+ this.dispatchEvent(new CustomEvent("BeforeHandleInput", { detail: a })), this.handleIntersections(i, o, s), this.dispatchEvent(new CustomEvent("AfterHandleInput", { detail: a }));
61965
61952
  }
61966
61953
  /** the raycast filter is always overriden */
61967
61954
  performRaycast(t) {
@@ -61976,15 +61963,22 @@ const Sa = class extends Ie {
61976
61963
  }
61977
61964
  return this._sortedHits.sort((i, s) => i.distance - s.distance), this._sortedHits;
61978
61965
  }
61979
- // Handles first hit that has a handler, the rest is ignored
61980
- handleIntersections(t, i) {
61981
- if (!t || t.length <= 0)
61982
- return !1;
61983
- t = this.sortCandidates(t);
61984
- for (const s of t) {
61985
- const { object: r } = s;
61986
- if (i.point = s.point, i.normal = s.normal, i.face = s.face, i.distance = s.distance, i.instanceId = s.instanceId, this.handleEventOnObject(r, i))
61987
- return !0;
61966
+ handleIntersections(t, i, s) {
61967
+ if (i != null && i.length) {
61968
+ i = this.sortCandidates(i);
61969
+ for (const o of i) {
61970
+ const { object: a } = o;
61971
+ if (s.point = o.point, s.normal = o.normal, s.face = o.face, s.distance = o.distance, s.instanceId = o.instanceId, this.handleEventOnObject(a, s))
61972
+ return !0;
61973
+ }
61974
+ }
61975
+ const r = this.hoveredByID.get(t);
61976
+ if (r && this.triggerOnExit(r.obj, r.data), this.hoveredByID.delete(t), s.isUp) {
61977
+ const o = this.pressedByID.get(t);
61978
+ o == null || o.handlers.forEach((a) => {
61979
+ var c;
61980
+ return (c = a.onPointerUp) == null ? void 0 : c.call(a, s);
61981
+ }), this.pressedByID.delete(t);
61988
61982
  }
61989
61983
  return !1;
61990
61984
  }