@idetik/core 0.39.0 → 0.40.0

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/dist/index.d.ts CHANGED
@@ -1841,6 +1841,10 @@ declare class OrbitControls implements CameraControls {
1841
1841
  private readonly dampingFactor_;
1842
1842
  private currMouseButton_;
1843
1843
  constructor(camera: PerspectiveCamera, params?: OrbitControlsProps);
1844
+ get radius(): number;
1845
+ get yaw(): number;
1846
+ get pitch(): number;
1847
+ get target(): vec3;
1844
1848
  get isMoving(): boolean;
1845
1849
  onEvent(event: EventContext): void;
1846
1850
  onUpdate(dt: number): void;
package/dist/index.js CHANGED
@@ -834,8 +834,8 @@ function $() {
834
834
  return X != Float32Array && (g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[11] = 0, g[12] = 0, g[13] = 0, g[14] = 0), g[0] = 1, g[5] = 1, g[10] = 1, g[15] = 1, g;
835
835
  }
836
836
  function OA(g, A) {
837
- var I = A[0], B = A[1], C = A[2], Q = A[3], E = A[4], i = A[5], o = A[6], a = A[7], s = A[8], D = A[9], h = A[10], t = A[11], y = A[12], n = A[13], F = A[14], G = A[15], J = I * i - B * E, U = I * o - C * E, S = I * a - Q * E, r = B * o - C * i, c = B * a - Q * i, f = C * a - Q * o, Z = s * n - D * y, j = s * F - h * y, b = s * G - t * y, z = D * F - h * n, iA = D * G - t * n, oA = h * G - t * F, P = J * oA - U * iA + S * z + r * b - c * j + f * Z;
838
- return P ? (P = 1 / P, g[0] = (i * oA - o * iA + a * z) * P, g[1] = (C * iA - B * oA - Q * z) * P, g[2] = (n * f - F * c + G * r) * P, g[3] = (h * c - D * f - t * r) * P, g[4] = (o * b - E * oA - a * j) * P, g[5] = (I * oA - C * b + Q * j) * P, g[6] = (F * S - y * f - G * U) * P, g[7] = (s * f - h * S + t * U) * P, g[8] = (E * iA - i * b + a * Z) * P, g[9] = (B * b - I * iA - Q * Z) * P, g[10] = (y * c - n * S + G * J) * P, g[11] = (D * S - s * c - t * J) * P, g[12] = (i * j - E * z - o * Z) * P, g[13] = (I * z - B * j + C * Z) * P, g[14] = (n * U - y * r - F * J) * P, g[15] = (s * r - D * U + h * J) * P, g) : null;
837
+ var I = A[0], B = A[1], C = A[2], Q = A[3], E = A[4], i = A[5], o = A[6], a = A[7], s = A[8], D = A[9], h = A[10], t = A[11], y = A[12], n = A[13], F = A[14], G = A[15], J = I * i - B * E, U = I * o - C * E, S = I * a - Q * E, r = B * o - C * i, c = B * a - Q * i, f = C * a - Q * o, Z = s * n - D * y, j = s * F - h * y, b = s * G - t * y, z = D * F - h * n, oA = D * G - t * n, aA = h * G - t * F, P = J * aA - U * oA + S * z + r * b - c * j + f * Z;
838
+ return P ? (P = 1 / P, g[0] = (i * aA - o * oA + a * z) * P, g[1] = (C * oA - B * aA - Q * z) * P, g[2] = (n * f - F * c + G * r) * P, g[3] = (h * c - D * f - t * r) * P, g[4] = (o * b - E * aA - a * j) * P, g[5] = (I * aA - C * b + Q * j) * P, g[6] = (F * S - y * f - G * U) * P, g[7] = (s * f - h * S + t * U) * P, g[8] = (E * oA - i * b + a * Z) * P, g[9] = (B * b - I * oA - Q * Z) * P, g[10] = (y * c - n * S + G * J) * P, g[11] = (D * S - s * c - t * J) * P, g[12] = (i * j - E * z - o * Z) * P, g[13] = (I * z - B * j + C * Z) * P, g[14] = (n * U - y * r - F * J) * P, g[15] = (s * r - D * U + h * J) * P, g) : null;
839
839
  }
840
840
  function QI(g, A, I) {
841
841
  var B = A[0], C = A[1], Q = A[2], E = A[3], i = A[4], o = A[5], a = A[6], s = A[7], D = A[8], h = A[9], t = A[10], y = A[11], n = A[12], F = A[13], G = A[14], J = A[15], U = I[0], S = I[1], r = I[2], c = I[3];
@@ -874,14 +874,14 @@ function XC(g, A, I, B) {
874
874
  return t = y * y + n * n + F * F, t > 0 && (t = 1 / Math.sqrt(t), y *= t, n *= t, F *= t), g[0] = y, g[1] = n, g[2] = F, g[3] = 0, g[4] = D * F - h * n, g[5] = h * y - s * F, g[6] = s * n - D * y, g[7] = 0, g[8] = s, g[9] = D, g[10] = h, g[11] = 0, g[12] = C, g[13] = Q, g[14] = E, g[15] = 1, g;
875
875
  }
876
876
  function jC(g, A) {
877
- var I = g[0], B = g[1], C = g[2], Q = g[3], E = g[4], i = g[5], o = g[6], a = g[7], s = g[8], D = g[9], h = g[10], t = g[11], y = g[12], n = g[13], F = g[14], G = g[15], J = A[0], U = A[1], S = A[2], r = A[3], c = A[4], f = A[5], Z = A[6], j = A[7], b = A[8], z = A[9], iA = A[10], oA = A[11], P = A[12], Wg = A[13], bg = A[14], Zg = A[15];
878
- return Math.abs(I - J) <= T * Math.max(1, Math.abs(I), Math.abs(J)) && Math.abs(B - U) <= T * Math.max(1, Math.abs(B), Math.abs(U)) && Math.abs(C - S) <= T * Math.max(1, Math.abs(C), Math.abs(S)) && Math.abs(Q - r) <= T * Math.max(1, Math.abs(Q), Math.abs(r)) && Math.abs(E - c) <= T * Math.max(1, Math.abs(E), Math.abs(c)) && Math.abs(i - f) <= T * Math.max(1, Math.abs(i), Math.abs(f)) && Math.abs(o - Z) <= T * Math.max(1, Math.abs(o), Math.abs(Z)) && Math.abs(a - j) <= T * Math.max(1, Math.abs(a), Math.abs(j)) && Math.abs(s - b) <= T * Math.max(1, Math.abs(s), Math.abs(b)) && Math.abs(D - z) <= T * Math.max(1, Math.abs(D), Math.abs(z)) && Math.abs(h - iA) <= T * Math.max(1, Math.abs(h), Math.abs(iA)) && Math.abs(t - oA) <= T * Math.max(1, Math.abs(t), Math.abs(oA)) && Math.abs(y - P) <= T * Math.max(1, Math.abs(y), Math.abs(P)) && Math.abs(n - Wg) <= T * Math.max(1, Math.abs(n), Math.abs(Wg)) && Math.abs(F - bg) <= T * Math.max(1, Math.abs(F), Math.abs(bg)) && Math.abs(G - Zg) <= T * Math.max(1, Math.abs(G), Math.abs(Zg));
877
+ var I = g[0], B = g[1], C = g[2], Q = g[3], E = g[4], i = g[5], o = g[6], a = g[7], s = g[8], D = g[9], h = g[10], t = g[11], y = g[12], n = g[13], F = g[14], G = g[15], J = A[0], U = A[1], S = A[2], r = A[3], c = A[4], f = A[5], Z = A[6], j = A[7], b = A[8], z = A[9], oA = A[10], aA = A[11], P = A[12], Wg = A[13], bg = A[14], Zg = A[15];
878
+ return Math.abs(I - J) <= T * Math.max(1, Math.abs(I), Math.abs(J)) && Math.abs(B - U) <= T * Math.max(1, Math.abs(B), Math.abs(U)) && Math.abs(C - S) <= T * Math.max(1, Math.abs(C), Math.abs(S)) && Math.abs(Q - r) <= T * Math.max(1, Math.abs(Q), Math.abs(r)) && Math.abs(E - c) <= T * Math.max(1, Math.abs(E), Math.abs(c)) && Math.abs(i - f) <= T * Math.max(1, Math.abs(i), Math.abs(f)) && Math.abs(o - Z) <= T * Math.max(1, Math.abs(o), Math.abs(Z)) && Math.abs(a - j) <= T * Math.max(1, Math.abs(a), Math.abs(j)) && Math.abs(s - b) <= T * Math.max(1, Math.abs(s), Math.abs(b)) && Math.abs(D - z) <= T * Math.max(1, Math.abs(D), Math.abs(z)) && Math.abs(h - oA) <= T * Math.max(1, Math.abs(h), Math.abs(oA)) && Math.abs(t - aA) <= T * Math.max(1, Math.abs(t), Math.abs(aA)) && Math.abs(y - P) <= T * Math.max(1, Math.abs(y), Math.abs(P)) && Math.abs(n - Wg) <= T * Math.max(1, Math.abs(n), Math.abs(Wg)) && Math.abs(F - bg) <= T * Math.max(1, Math.abs(F), Math.abs(bg)) && Math.abs(G - Zg) <= T * Math.max(1, Math.abs(G), Math.abs(Zg));
879
879
  }
880
880
  function d() {
881
881
  var g = new X(3);
882
882
  return X != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g;
883
883
  }
884
- function sA(g) {
884
+ function EA(g) {
885
885
  var A = new X(3);
886
886
  return A[0] = g[0], A[1] = g[1], A[2] = g[2], A;
887
887
  }
@@ -1088,7 +1088,7 @@ class SA {
1088
1088
  * the first element, and avoids biasing toward (0,0,0).
1089
1089
  */
1090
1090
  constructor(A, I) {
1091
- this.min = A ? sA(A) : p(1 / 0, 1 / 0, 1 / 0), this.max = I ? sA(I) : p(-1 / 0, -1 / 0, -1 / 0);
1091
+ this.min = A ? EA(A) : p(1 / 0, 1 / 0, 1 / 0), this.max = I ? EA(I) : p(-1 / 0, -1 / 0, -1 / 0);
1092
1092
  }
1093
1093
  clone() {
1094
1094
  return new SA(this.min, this.max);
@@ -2964,7 +2964,7 @@ class mQ {
2964
2964
  origin;
2965
2965
  direction;
2966
2966
  constructor(A, I) {
2967
- this.origin = sA(A), this.direction = XB(d(), I);
2967
+ this.origin = EA(A), this.direction = XB(d(), I);
2968
2968
  }
2969
2969
  intersectWithPlane(A) {
2970
2970
  const I = sI(this.direction, A.normal);
@@ -8564,10 +8564,10 @@ function HE(g) {
8564
8564
  }
8565
8565
  }
8566
8566
  const qE = Math.max(1, navigator.hardwareConcurrency - 2);
8567
- let EA = [], lE = 0, iC = 0;
8567
+ let iA = [], lE = 0, iC = 0;
8568
8568
  const NA = /* @__PURE__ */ new Map(), SI = /* @__PURE__ */ new Set();
8569
8569
  function oC(g) {
8570
- const A = EA.find((I) => I.worker === g);
8570
+ const A = iA.find((I) => I.worker === g);
8571
8571
  return A || k.error(
8572
8572
  "ZarrWorker",
8573
8573
  "Worker not found in pool - this should not happen"
@@ -8605,8 +8605,8 @@ function RB(g, A) {
8605
8605
  );
8606
8606
  const I = oC(A);
8607
8607
  if (I) {
8608
- const C = EA.indexOf(I);
8609
- EA.splice(C, 1);
8608
+ const C = iA.indexOf(I);
8609
+ iA.splice(C, 1);
8610
8610
  }
8611
8611
  const B = I?.workerId;
8612
8612
  if (B !== void 0)
@@ -8614,7 +8614,7 @@ function RB(g, A) {
8614
8614
  Q.workerId === B && (Q.reject(new Error(`Worker error: ${g.message}`)), NA.delete(C));
8615
8615
  try {
8616
8616
  const C = aC();
8617
- EA.push({
8617
+ iA.push({
8618
8618
  worker: C,
8619
8619
  pendingCount: 0,
8620
8620
  workerId: iC++
@@ -8631,9 +8631,9 @@ function aC() {
8631
8631
  ), g;
8632
8632
  }
8633
8633
  function pE() {
8634
- if (EA.length === 0)
8634
+ if (iA.length === 0)
8635
8635
  throw new Error("Worker pool is not initialized");
8636
- return EA.sort((g, A) => g.pendingCount - A.pendingCount)[0];
8636
+ return iA.sort((g, A) => g.pendingCount - A.pendingCount)[0];
8637
8637
  }
8638
8638
  async function mE(g, A, I, B) {
8639
8639
  return new Promise((C, Q) => {
@@ -8665,11 +8665,11 @@ async function mE(g, A, I, B) {
8665
8665
  });
8666
8666
  }
8667
8667
  function uE() {
8668
- if (!(EA.length > 0))
8668
+ if (!(iA.length > 0))
8669
8669
  try {
8670
8670
  for (let g = 0; g < qE; g++) {
8671
8671
  const A = aC();
8672
- EA.push({
8672
+ iA.push({
8673
8673
  worker: A,
8674
8674
  pendingCount: 0,
8675
8675
  workerId: iC++
@@ -8677,7 +8677,7 @@ function uE() {
8677
8677
  }
8678
8678
  k.debug(
8679
8679
  "ZarrWorker",
8680
- `Initialized worker pool with ${EA.length} workers`
8680
+ `Initialized worker pool with ${iA.length} workers`
8681
8681
  );
8682
8682
  } catch {
8683
8683
  k.warn("ZarrWorker", "Failed to create workers - clearing pool"), xE();
@@ -8711,9 +8711,9 @@ async function TE(g, A, I, B, C) {
8711
8711
  }
8712
8712
  }
8713
8713
  function xE() {
8714
- for (const g of EA)
8714
+ for (const g of iA)
8715
8715
  g.worker.terminate();
8716
- EA = [], NA.clear();
8716
+ iA = [], NA.clear();
8717
8717
  }
8718
8718
  class WE {
8719
8719
  metadata_;
@@ -12230,7 +12230,7 @@ class eC {
12230
12230
  jI(this.translation_, A), this.dirty_ = !0;
12231
12231
  }
12232
12232
  get translation() {
12233
- return sA(this.translation_);
12233
+ return EA(this.translation_);
12234
12234
  }
12235
12235
  addScale(A) {
12236
12236
  zC(this.scale_, this.scale_, A), this.dirty_ = !0;
@@ -12239,12 +12239,12 @@ class eC {
12239
12239
  jI(this.scale_, A), this.dirty_ = !0;
12240
12240
  }
12241
12241
  targetTo(A) {
12242
- Gg(this.translation_, A) && (A = sA(A), A[2] += T);
12242
+ Gg(this.translation_, A) && (A = EA(A), A[2] += T);
12243
12243
  const I = XC($(), this.translation_, A, fi), B = xC(VB(), I);
12244
12244
  wg(this.rotation_, B), MI(this.rotation_, this.rotation_), this.dirty_ = !0;
12245
12245
  }
12246
12246
  get scale() {
12247
- return sA(this.scale_);
12247
+ return EA(this.scale_);
12248
12248
  }
12249
12249
  get matrix() {
12250
12250
  return this.dirty_ && (this.computeMatrix(), this.dirty_ = !1), this.matrix_;
@@ -12672,17 +12672,17 @@ function xi(g) {
12672
12672
  return "floatScalarImage";
12673
12673
  }
12674
12674
  }
12675
- class aA {
12675
+ class sA {
12676
12676
  normal;
12677
12677
  signedDistance;
12678
12678
  constructor(A = p(0, 1, 0), I = 0) {
12679
- this.normal = sA(A), this.signedDistance = I;
12679
+ this.normal = EA(A), this.signedDistance = I;
12680
12680
  }
12681
12681
  static fromPointAndNormal(A, I) {
12682
- return new aA(I, -sI(I, A));
12682
+ return new sA(I, -sI(I, A));
12683
12683
  }
12684
12684
  set(A, I) {
12685
- this.normal = sA(A), this.signedDistance = I;
12685
+ this.normal = EA(A), this.signedDistance = I;
12686
12686
  }
12687
12687
  signedDistanceToPoint(A) {
12688
12688
  return sI(this.normal, A) + this.signedDistance;
@@ -12860,7 +12860,7 @@ class rC extends qI {
12860
12860
  d(),
12861
12861
  p(0, 0, 1),
12862
12862
  B.rotation
12863
- ), Q = aA.fromPointAndNormal(B.translation, C), E = A.intersectWithPlane(Q);
12863
+ ), Q = sA.fromPointAndNormal(B.translation, C), E = A.intersectWithPlane(Q);
12864
12864
  if (!E) return null;
12865
12865
  const i = await this.getValueAtWorld(E);
12866
12866
  return i === null ? null : { world: E, value: i };
@@ -13013,7 +13013,7 @@ class Wi extends mA {
13013
13013
  b[A] = j * C, b[I] = f * Q, b[B] = J;
13014
13014
  const z = { x: 0, y: 0, z: 0 };
13015
13015
  z[B] = D;
13016
- const iA = Z / a, oA = 1 - c / s;
13016
+ const oA = Z / a, aA = 1 - c / s;
13017
13017
  h.push(
13018
13018
  b.x,
13019
13019
  b.y,
@@ -13021,8 +13021,8 @@ class Wi extends mA {
13021
13021
  z.x,
13022
13022
  z.y,
13023
13023
  z.z,
13024
- iA,
13025
- oA
13024
+ oA,
13025
+ aA
13026
13026
  );
13027
13027
  }
13028
13028
  }
@@ -13537,7 +13537,7 @@ class RC extends qI {
13537
13537
  d(),
13538
13538
  p(0, 0, 1),
13539
13539
  B.rotation
13540
- ), Q = aA.fromPointAndNormal(B.translation, C), E = A.intersectWithPlane(Q);
13540
+ ), Q = sA.fromPointAndNormal(B.translation, C), E = A.intersectWithPlane(Q);
13541
13541
  if (!E) return null;
13542
13542
  const i = await this.getValueAtWorld(E);
13543
13543
  return i === null ? null : { world: E, value: i };
@@ -13769,6 +13769,18 @@ class Lo {
13769
13769
  1
13770
13770
  ), this.updateCamera();
13771
13771
  }
13772
+ get radius() {
13773
+ return this.currPos_.radius;
13774
+ }
13775
+ get yaw() {
13776
+ return this.currPos_.phi;
13777
+ }
13778
+ get pitch() {
13779
+ return this.currPos_.theta;
13780
+ }
13781
+ get target() {
13782
+ return EA(this.currCenter_);
13783
+ }
13772
13784
  get isMoving() {
13773
13785
  return this.orbitVelocity_.phi !== 0 || this.orbitVelocity_.theta !== 0 || this.orbitVelocity_.radius !== 0 || this.panVelocity_[0] !== 0 || this.panVelocity_[1] !== 0 || this.panVelocity_[2] !== 0;
13774
13786
  }
@@ -13840,12 +13852,12 @@ class Do {
13840
13852
  planes_;
13841
13853
  constructor(A) {
13842
13854
  this.planes_ = [
13843
- new aA(d(), 0),
13844
- new aA(d(), 0),
13845
- new aA(d(), 0),
13846
- new aA(d(), 0),
13847
- new aA(d(), 0),
13848
- new aA(d(), 0)
13855
+ new sA(d(), 0),
13856
+ new sA(d(), 0),
13857
+ new sA(d(), 0),
13858
+ new sA(d(), 0),
13859
+ new sA(d(), 0),
13860
+ new sA(d(), 0)
13849
13861
  ], this.setWithViewProjection(A);
13850
13862
  }
13851
13863
  // Uses the fast plane-extraction algorithm described in
@@ -14051,14 +14063,14 @@ class Yo {
14051
14063
  if (!A.worldPos || !A.clipPos) return;
14052
14064
  const I = A.event;
14053
14065
  I.preventDefault();
14054
- const B = sA(A.worldPos), C = I.deltaY < 0 ? 1.05 : 0.95;
14066
+ const B = EA(A.worldPos), C = I.deltaY < 0 ? 1.05 : 0.95;
14055
14067
  this.camera_.zoom(C);
14056
14068
  const Q = this.camera_.clipToWorld(A.clipPos), E = $I(d(), B, Q);
14057
14069
  this.camera_.pan(E);
14058
14070
  }
14059
14071
  onPointerDown(A) {
14060
14072
  const I = A.event;
14061
- !A.worldPos || I.button !== PB || (this.dragStart_ = sA(A.worldPos), this.dragActive_ = !0, I.target?.setPointerCapture?.(I.pointerId));
14073
+ !A.worldPos || I.button !== PB || (this.dragStart_ = EA(A.worldPos), this.dragActive_ = !0, I.target?.setPointerCapture?.(I.pointerId));
14062
14074
  }
14063
14075
  onPointerMove(A) {
14064
14076
  if (!this.dragActive_ || !A.worldPos) return;