@lumiscaphe/viewer 4.2.0 → 4.2.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/dist/lib/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".ls-viewer-container{display:block;position:relative;overflow:hidden;-webkit-user-select:none;user-select:none;width:100%;height:100%}.ls-viewer-container-image,.ls-viewer-container-video{cursor:default;pointer-events:none}.ls-viewer-container-vrcube{cursor:pointer;cursor:grab}.ls-viewer-container-vrcube-grabbing{cursor:move;cursor:grabbing}.ls-viewer-container-vrobject{cursor:move;cursor:grab}.ls-viewer-container-vrobject-grabbing{cursor:move;cursor:grabbing}.ls-viewer-container-loading{cursor:progress}.ls-viewer-canvas{position:absolute;opacity:0;transition:opacity .5s}.ls-viewer-video{position:absolute}")),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
- import C from "debounce-promise";
3
- import * as P from "twgl.js";
2
+ import V from "debounce-promise";
3
+ import * as M from "twgl.js";
4
4
  import { v3 as h, m4 as c } from "twgl.js";
5
- import $ from "regression";
6
- class b {
5
+ import U from "regression";
6
+ class y {
7
7
  constructor(t, e) {
8
8
  this.width = t, this.height = e;
9
9
  }
@@ -11,7 +11,7 @@ class b {
11
11
  return this.width / this.height;
12
12
  }
13
13
  }
14
- class p {
14
+ const P = class P {
15
15
  constructor(t, e, i, s) {
16
16
  this.top = t, this.left = e, this.width = i, this.height = s;
17
17
  }
@@ -34,51 +34,54 @@ class p {
34
34
  break;
35
35
  }
36
36
  const o = (e.height - n) / 2, u = (e.width - a) / 2;
37
- return new p(o, u, a, n);
37
+ return new P(o, u, a, n);
38
38
  }
39
39
  static project(t, e, i, s) {
40
- const r = p.fit(t, e, i), a = r.width / t.width, n = r.height / t.height;
40
+ const r = P.fit(t, e, i), a = r.width / t.width, n = r.height / t.height;
41
41
  return {
42
42
  x: Math.round(r.left + s.x * a),
43
43
  y: Math.round(r.top + s.y * n)
44
44
  };
45
45
  }
46
46
  static unproject(t, e, i, s) {
47
- const r = p.fit(t, e, i), a = r.width / t.width, n = r.height / t.height;
47
+ const r = P.fit(t, e, i), a = r.width / t.width, n = r.height / t.height;
48
48
  return {
49
49
  x: Math.round((s.x - r.left) / a),
50
50
  y: Math.round((s.y - r.top) / n)
51
51
  };
52
52
  }
53
- static getStandardAspectRatio(t, e) {
53
+ static getStandardAspectRatio(t, e, i) {
54
54
  if (t === 0 || e === 0)
55
55
  return 0;
56
- const i = t / e;
57
- if (t < e) {
58
- const a = Math.abs(0.75 - i), n = Math.abs(9 / 16 - i);
59
- return a < n ? 3 / 4 : 9 / 16;
60
- }
61
- const s = Math.abs(4 / 3 - i), r = Math.abs(16 / 9 - i);
62
- return s < r ? 4 / 3 : 16 / 9;
56
+ if (i)
57
+ return i;
58
+ const s = t / e;
59
+ return t < e ? s < P.PORTRAIT_ASPECT_BOUNDARY ? 9 / 16 : 3 / 4 : s < P.LANDSCAPE_ASPECT_BOUNDARY ? 4 / 3 : 16 / 9;
63
60
  }
64
- static getStandardResolution(t, e) {
61
+ static getStandardResolution(t, e, i) {
65
62
  if (t === 0 || e === 0)
66
- return new b(0, 0);
67
- const i = p.getStandardAspectRatio(t, e);
63
+ return new y(0, 0);
64
+ const s = P.getStandardAspectRatio(t, e, i);
65
+ if (i) {
66
+ const a = P.getStandardQuality(Math.min(t, e));
67
+ return new y(Math.round(a * s), Math.round(a));
68
+ }
68
69
  if (t < e) {
69
- const r = p.getStandardQuality(Math.max(e * i, t));
70
- return new b(Math.round(r), Math.round(r / i));
70
+ const a = P.getStandardQuality(Math.max(e * s, t));
71
+ return new y(Math.round(a), Math.round(a / s));
71
72
  }
72
- const s = p.getStandardQuality(Math.max(t / i, e));
73
- return new b(Math.round(s * i), Math.round(s));
73
+ const r = P.getStandardQuality(Math.max(t / s, e));
74
+ return new y(Math.round(r * s), Math.round(r));
74
75
  }
75
76
  static getStandardQuality(t) {
76
77
  return t <= 720 ? 720 : 1080;
77
78
  }
78
- }
79
- class U {
79
+ };
80
+ P.LANDSCAPE_ASPECT_BOUNDARY = Math.sqrt(4 / 3 * (16 / 9)), P.PORTRAIT_ASPECT_BOUNDARY = Math.sqrt(3 / 4 * (9 / 16));
81
+ let b = P;
82
+ class N {
80
83
  constructor(t) {
81
- this.element = document.createElement("canvas"), this.element.classList.add("ls-viewer-canvas"), this.element.style.opacity = "0", this.element.width = 0, this.element.height = 0, this.context = this.element.getContext("2d"), this.backCanvas = document.createElement("canvas"), this.backContext = this.backCanvas.getContext("2d"), this.fit = t, this.pixelRatio = 1;
84
+ this.element = document.createElement("canvas"), this.element.classList.add("ls-viewer-canvas"), this.element.style.opacity = "0", this.element.width = 0, this.element.height = 0, this.context = this.element.getContext("2d"), this.context.imageSmoothingQuality = "high", this.backCanvas = document.createElement("canvas"), this.backContext = this.backCanvas.getContext("2d"), this.backContext.imageSmoothingQuality = "high", this.fit = t;
82
85
  }
83
86
  destroy() {
84
87
  this.requestAnimationId && (cancelAnimationFrame(this.requestAnimationId), this.requestAnimationId = void 0);
@@ -89,17 +92,15 @@ class U {
89
92
  hide(t) {
90
93
  t ? this.element.style.display = "none" : this.element.style.opacity = "0";
91
94
  }
92
- get resolution() {
93
- return new b(this.element.width / this.pixelRatio, this.element.height / this.pixelRatio);
94
- }
95
95
  resize(t, e, i) {
96
- this.element.width = t * i, this.element.height = e * i, this.element.style.width = `${t}px`, this.element.style.height = `${e}px`, this.backCanvas.width = t * i, this.backCanvas.height = e * i, this.pixelRatio = i;
96
+ const s = Math.floor(t * i), r = Math.floor(e * i);
97
+ this.element.style.width = `${t}px`, this.element.style.height = `${e}px`, !(this.element.width === s && this.element.height === r) && (this.element.width = s, this.element.height = r, this.context.imageSmoothingQuality = "high", this.backCanvas.width = s, this.backCanvas.height = r, this.backContext.imageSmoothingQuality = "high", this.image && this.draw(this.image, !1));
97
98
  }
98
99
  draw(t, e, i) {
99
100
  if (!t)
100
101
  return;
101
102
  this.requestAnimationId && (cancelAnimationFrame(this.requestAnimationId), this.requestAnimationId = void 0);
102
- const s = p.fit(new b(t.width, t.height), new b(this.element.width, this.element.height), this.fit);
103
+ const s = b.fit(new y(t.width, t.height), new y(this.element.width, this.element.height), this.fit);
103
104
  e ? (this.backContext.drawImage(this.element, 0, 0), this.context.globalAlpha = 0, this.fadeLoop(t, i || 0)) : (this.context.globalAlpha = 1, this.context.drawImage(t, s.left, s.top, s.width, s.height)), this.image = t;
104
105
  }
105
106
  fadeLoop(t, e) {
@@ -107,15 +108,15 @@ class U {
107
108
  cancelAnimationFrame(this.requestAnimationId), this.requestAnimationId = void 0;
108
109
  return;
109
110
  }
110
- const i = Math.min(this.context.globalAlpha + e, 1), s = p.fit(new b(t.width, t.height), new b(this.element.width, this.element.height), this.fit);
111
+ const i = Math.min(this.context.globalAlpha + e, 1), s = b.fit(new y(t.width, t.height), new y(this.element.width, this.element.height), this.fit);
111
112
  this.context.clearRect(0, 0, this.element.width, this.element.height), this.context.globalAlpha = 1, this.context.drawImage(this.backCanvas, 0, 0), this.context.globalAlpha = i, this.context.drawImage(t, s.left, s.top, s.width, s.height), this.requestAnimationId = requestAnimationFrame(() => {
112
113
  this.fadeLoop(t, e);
113
114
  });
114
115
  }
115
116
  }
116
- class N {
117
+ class B {
117
118
  constructor() {
118
- this.element = document.createElement("canvas"), this.element.classList.add("ls-viewer-canvas"), this.element.style.opacity = "0", this.element.width = 0, this.element.height = 0, this.context = P.getContext(this.element, { preserveDrawingBuffer: !0 }), this.context && this.context.isContextLost() && (this.context = void 0), P.setDefaults({ textureColor: [1, 1, 1, 1] });
119
+ this.element = document.createElement("canvas"), this.element.classList.add("ls-viewer-canvas"), this.element.style.opacity = "0", this.element.width = 0, this.element.height = 0, this.context = M.getContext(this.element, { preserveDrawingBuffer: !0 }), this.context && this.context.isContextLost() && (this.context = void 0), M.setDefaults({ textureColor: [1, 1, 1, 1] });
119
120
  }
120
121
  show() {
121
122
  this.element.style.opacity = "1";
@@ -154,11 +155,11 @@ class w {
154
155
  }
155
156
  static perspectiveWithLeft(t, e, i, s, r, a, n) {
156
157
  n = n || new Float32Array(16);
157
- const o = e + t, u = e - t, m = s + i, f = s - i, d = a - r;
158
- return n[0] = 2 * r / u, n[1] = 0, n[2] = 0, n[3] = 0, n[4] = 0, n[5] = 2 * r / f, n[6] = 0, n[7] = 0, n[8] = o / u, n[9] = m / f, n[10] = -a / d, n[11] = -1, n[12] = 0, n[13] = 0, n[14] = -a * r / d, n[15] = 0, n;
158
+ const o = e + t, u = e - t, l = s + i, p = s - i, d = a - r;
159
+ return n[0] = 2 * r / u, n[1] = 0, n[2] = 0, n[3] = 0, n[4] = 0, n[5] = 2 * r / p, n[6] = 0, n[7] = 0, n[8] = o / u, n[9] = l / p, n[10] = -a / d, n[11] = -1, n[12] = 0, n[13] = 0, n[14] = -a * r / d, n[15] = 0, n;
159
160
  }
160
161
  }
161
- const A = class A {
162
+ const O = class O {
162
163
  static initCubeFace(t, e, i) {
163
164
  let s = [0, 0, 0];
164
165
  const r = h.subtract(e, t), a = h.mulScalar([0, 1, 0], h.length(r)), n = h.mulScalar(h.normalize(h.cross(r, a)), h.length(r)), o = h.mulScalar(h.normalize(h.cross(a, n)), h.length(r));
@@ -182,7 +183,7 @@ const A = class A {
182
183
  e = h.subtract(t, a), s = h.normalize(o);
183
184
  break;
184
185
  }
185
- return new A(e, t, s);
186
+ return new O(e, t, s);
186
187
  }
187
188
  constructor(t, e, i) {
188
189
  this.target = h.copy(t), this.eye = h.copy(e), this.up = h.copy(i);
@@ -197,12 +198,12 @@ const A = class A {
197
198
  return c.inverse(c.lookAt(this.eye, this.target, this.up));
198
199
  }
199
200
  clone() {
200
- return new A(h.copy(this.target), h.copy(this.eye), h.copy(this.up));
201
+ return new O(h.copy(this.target), h.copy(this.eye), h.copy(this.up));
201
202
  }
202
203
  };
203
- A.default = new A([0, 0, 0], [2, 2, 2], [0, 1, 0]);
204
- let L = A;
205
- class B {
204
+ O.default = new O([0, 0, 0], [2, 2, 2], [0, 1, 0]);
205
+ let S = O;
206
+ class X {
206
207
  constructor(t) {
207
208
  this.target = t.target;
208
209
  const e = h.normalize(h.subtract(t.eye, t.target)), i = h.dot(e, [1, 0, 0]), s = h.dot(e, [0, 1, 0]), r = h.dot(e, [0, 0, 1]);
@@ -219,10 +220,10 @@ class B {
219
220
  let n = [0, 1, 0];
220
221
  n = c.transformPoint(r, n);
221
222
  const o = h.subtract(t, h.mulScalar(a, this.distance));
222
- return new L(t, o, n);
223
+ return new S(t, o, n);
223
224
  }
224
225
  }
225
- class X {
226
+ class Y {
226
227
  constructor() {
227
228
  }
228
229
  async animation(t) {
@@ -277,7 +278,7 @@ class H {
277
278
  return {
278
279
  id: t.getAttribute("id"),
279
280
  name: t.getAttribute("name"),
280
- pointOfView: new L(
281
+ pointOfView: new S(
281
282
  [
282
283
  parseFloat(t.querySelector("PointOfView Target").getAttribute("x")),
283
284
  //
@@ -415,8 +416,8 @@ const g = class g {
415
416
  }
416
417
  };
417
418
  g.xmlRegex = /directUrl="([^"]*)"/g;
418
- let S = g;
419
- class l {
419
+ let F = g;
420
+ class m {
420
421
  constructor(t) {
421
422
  this.server = t;
422
423
  }
@@ -482,29 +483,29 @@ class l {
482
483
  }
483
484
  async image(t) {
484
485
  const e = {
485
- scene: l.scene(t),
486
+ scene: m.scene(t),
486
487
  mode: {
487
488
  image: {
488
489
  camera: t.view.camera
489
490
  }
490
491
  },
491
- renderParameters: l.renderParameters(t),
492
- encoder: l.encoder(t)
492
+ renderParameters: m.renderParameters(t),
493
+ encoder: m.encoder(t)
493
494
  };
494
- return l.fetchFrame(`${this.server}/Snapshot`, e);
495
+ return m.fetchFrame(`${this.server}/Snapshot`, e);
495
496
  }
496
497
  async vrCube(t) {
497
498
  const e = {
498
- scene: l.scene(t),
499
+ scene: m.scene(t),
499
500
  mode: {
500
501
  vrCube: {
501
502
  camera: t.view.camera
502
503
  }
503
504
  },
504
- renderParameters: l.renderParameters(t),
505
- encoder: l.encoder(t)
505
+ renderParameters: m.renderParameters(t),
506
+ encoder: m.encoder(t)
506
507
  };
507
- return e.renderParameters.width = Math.max(e.renderParameters.width, e.renderParameters.height), e.renderParameters.height = Math.max(e.renderParameters.width, e.renderParameters.height), l.fetchFrameArray(`${this.server}/Snapshot`, e);
508
+ return e.renderParameters.width = Math.max(e.renderParameters.width, e.renderParameters.height), e.renderParameters.height = Math.max(e.renderParameters.width, e.renderParameters.height), m.fetchFrameArray(`${this.server}/Snapshot`, e);
508
509
  }
509
510
  async vrObject(t) {
510
511
  let e;
@@ -531,16 +532,16 @@ class l {
531
532
  }
532
533
  };
533
534
  const i = {
534
- scene: l.scene(t),
535
+ scene: m.scene(t),
535
536
  mode: e,
536
- renderParameters: l.renderParameters(t),
537
- encoder: l.encoder(t)
537
+ renderParameters: m.renderParameters(t),
538
+ encoder: m.encoder(t)
538
539
  };
539
- return l.fetchFrameArray(`${this.server}/Snapshot`, i);
540
+ return m.fetchFrameArray(`${this.server}/Snapshot`, i);
540
541
  }
541
542
  async animation(t) {
542
543
  const e = {
543
- scene: l.scene(t),
544
+ scene: m.scene(t),
544
545
  mode: {
545
546
  animation: {
546
547
  id: t.view.animation,
@@ -548,45 +549,45 @@ class l {
548
549
  fps: t.view.fps
549
550
  }
550
551
  },
551
- renderParameters: l.renderParameters(t),
552
- encoder: l.encoder(t)
552
+ renderParameters: m.renderParameters(t),
553
+ encoder: m.encoder(t)
553
554
  };
554
- return l.fetchFrameArray(`${this.server}/Snapshot`, e);
555
+ return m.fetchFrameArray(`${this.server}/Snapshot`, e);
555
556
  }
556
557
  async imageHotspots(t, e) {
557
558
  const i = {
558
- scene: l.scene(t),
559
+ scene: m.scene(t),
559
560
  mode: {
560
561
  image: {
561
562
  camera: t.view.camera
562
563
  }
563
564
  },
564
- renderParameters: l.renderParameters(t),
565
+ renderParameters: m.renderParameters(t),
565
566
  ...this.hotspotsBody(e)
566
567
  };
567
- return await l.fetchHotspots(`${this.server}/Hotspot`, i);
568
+ return await m.fetchHotspots(`${this.server}/Hotspot`, i);
568
569
  }
569
570
  async imagePick(t, e) {
570
571
  const i = {
571
- scene: l.scene(t),
572
+ scene: m.scene(t),
572
573
  camera: t.view.camera,
573
- renderParameters: l.renderParameters(t),
574
+ renderParameters: m.renderParameters(t),
574
575
  positions: [e]
575
576
  };
576
- return await l.fetchPick(`${this.server}/Pick`, i);
577
+ return await m.fetchPick(`${this.server}/Pick`, i);
577
578
  }
578
579
  async vrCubeHotspots(t, e) {
579
580
  const i = {
580
- scene: l.scene(t),
581
+ scene: m.scene(t),
581
582
  mode: {
582
583
  vrCube: {
583
584
  camera: t.view.camera
584
585
  }
585
586
  },
586
- renderParameters: l.renderParameters(t),
587
+ renderParameters: m.renderParameters(t),
587
588
  ...this.hotspotsBody(e)
588
589
  };
589
- return i.renderParameters.width = Math.max(i.renderParameters.width, i.renderParameters.height), i.renderParameters.height = Math.max(i.renderParameters.width, i.renderParameters.height), await l.fetchHotspotsArray(`${this.server}/Hotspot`, i);
590
+ return i.renderParameters.width = Math.max(i.renderParameters.width, i.renderParameters.height), i.renderParameters.height = Math.max(i.renderParameters.width, i.renderParameters.height), await m.fetchHotspotsArray(`${this.server}/Hotspot`, i);
590
591
  }
591
592
  async vrObjectHotspots(t, e) {
592
593
  let i;
@@ -613,12 +614,12 @@ class l {
613
614
  }
614
615
  };
615
616
  const s = {
616
- scene: l.scene(t),
617
+ scene: m.scene(t),
617
618
  mode: i,
618
- renderParameters: l.renderParameters(t),
619
+ renderParameters: m.renderParameters(t),
619
620
  ...this.hotspotsBody(e)
620
621
  };
621
- return await l.fetchHotspotsArray(`${this.server}/Hotspot`, s);
622
+ return await m.fetchHotspotsArray(`${this.server}/Hotspot`, s);
622
623
  }
623
624
  hotspotsBody(t) {
624
625
  return {
@@ -631,16 +632,16 @@ class D {
631
632
  constructor(t, e, i) {
632
633
  switch (e) {
633
634
  case "static":
634
- this.webrender = new X();
635
+ this.webrender = new Y();
635
636
  break;
636
637
  case "v1":
637
- this.webrender = new S(t), this.webrenderV2 = new l(t);
638
+ this.webrender = new F(t), this.webrenderV2 = new m(t);
638
639
  break;
639
640
  case "v2":
640
- this.webrender = new l(t), this.webrenderV2 = new l(t);
641
+ this.webrender = new m(t), this.webrenderV2 = new m(t);
641
642
  break;
642
643
  default:
643
- this.webrender = new S(t), this.webrenderV2 = new l(t);
644
+ this.webrender = new F(t), this.webrenderV2 = new m(t);
644
645
  break;
645
646
  }
646
647
  this.delegate = i, this.loadingId = 0, this.loaded = 0, this.total = 0, this.databases = [], this.onLoadStart = i && i.onLoadStart ? i.onLoadStart : () => {
@@ -699,8 +700,8 @@ class D {
699
700
  this.total = t.length;
700
701
  const r = new Array(t.length), a = i || 0;
701
702
  for (let n = 0, o = t.length; n < o; n += 1) {
702
- const u = Math.ceil(n / 2) * (n % 2 === 0 ? 1 : -1), m = e ? w.mod(a + u, o) : n;
703
- r[m] = this.loadImage(t[m], s);
703
+ const u = Math.ceil(n / 2) * (n % 2 === 0 ? 1 : -1), l = e ? w.mod(a + u, o) : n;
704
+ r[l] = this.loadImage(t[l], s);
704
705
  }
705
706
  return Promise.all(r).then(() => this.onLoadEnd(this.progress)).catch(() => {
706
707
  }), r;
@@ -734,15 +735,15 @@ class D {
734
735
  return;
735
736
  }
736
737
  t.removeEventListener("seeked", u);
737
- const m = document.createElement("canvas");
738
- m.width = t.videoWidth, m.height = t.videoHeight, m.getContext("2d").drawImage(t, 0, 0);
738
+ const l = document.createElement("canvas");
739
+ l.width = t.videoWidth, l.height = t.videoHeight, l.getContext("2d").drawImage(t, 0, 0);
739
740
  const d = new Image();
740
- d.src = m.toDataURL(), n(d), this.loaded += 1, this.onLoadProgress(this.progress), s !== i - 1 && (t.currentTime += 1 / e);
741
+ d.src = l.toDataURL(), n(d), this.loaded += 1, this.onLoadProgress(this.progress), s !== i - 1 && (t.currentTime += 1 / e);
741
742
  };
742
743
  t.addEventListener("seeked", u), t.addEventListener(
743
744
  "error",
744
- (m) => {
745
- r === this.loadingId && o(m);
745
+ (l) => {
746
+ r === this.loadingId && o(l);
746
747
  },
747
748
  { once: !0 }
748
749
  );
@@ -781,7 +782,7 @@ class D {
781
782
  return this.webrenderV2 ? await this.webrenderV2.imagePick(await this.vrCubeFrameSnapshot(t, i), e) : Promise.reject(new Error("Picking only available with api V2"));
782
783
  }
783
784
  async convert(t) {
784
- if (!this.webrenderV2 || this.webrender instanceof l || !t.view.camera)
785
+ if (!this.webrenderV2 || this.webrender instanceof m || !t.view.camera)
785
786
  return t;
786
787
  const e = t.scene.find((o) => !o.decor && !o.accessory);
787
788
  if (!e)
@@ -803,7 +804,7 @@ class D {
803
804
  if (!s)
804
805
  return t;
805
806
  let r = this.databases.find((a) => a.id === s.database);
806
- if (r || (r = await this.webrender.database(s.database), this.databases.push(r)), this.webrender instanceof S) {
807
+ if (r || (r = await this.webrender.database(s.database), this.databases.push(r)), this.webrender instanceof F) {
807
808
  if (!t.view.camera)
808
809
  return t;
809
810
  const a = r.getCameraGroupId(t.view.camera);
@@ -814,15 +815,15 @@ class D {
814
815
  return t;
815
816
  const o = n.cameras[e];
816
817
  return o ? { ...t, view: { ...t.view, camera: o.id } } : t;
817
- } else if (this.webrender instanceof l) {
818
+ } else if (this.webrender instanceof m) {
818
819
  const a = typeof t.view.camera == "string" ? t.view.camera : t.view.camera?.id;
819
820
  if (a) {
820
821
  const n = r.getCameraById(a);
821
822
  if (!n)
822
823
  return t;
823
- const o = new B(n.pointOfView), u = 2 * Math.PI / i;
824
+ const o = new X(n.pointOfView), u = 2 * Math.PI / i;
824
825
  o.longitude += e * u % (2 * Math.PI);
825
- const m = o.pointOfView(n.pointOfView.target);
826
+ const l = o.pointOfView(n.pointOfView.target);
826
827
  return {
827
828
  ...t,
828
829
  view: {
@@ -831,19 +832,19 @@ class D {
831
832
  id: n.id,
832
833
  pov: {
833
834
  target: {
834
- x: m.target[0],
835
- y: m.target[1],
836
- z: m.target[2]
835
+ x: l.target[0],
836
+ y: l.target[1],
837
+ z: l.target[2]
837
838
  },
838
839
  eye: {
839
- x: m.eye[0],
840
- y: m.eye[1],
841
- z: m.eye[2]
840
+ x: l.eye[0],
841
+ y: l.eye[1],
842
+ z: l.eye[2]
842
843
  },
843
844
  up: {
844
- x: m.up[0],
845
- y: m.up[1],
846
- z: m.up[2]
845
+ x: l.up[0],
846
+ y: l.up[1],
847
+ z: l.up[2]
847
848
  }
848
849
  }
849
850
  }
@@ -868,16 +869,16 @@ class D {
868
869
  if (s || (s = await this.webrender.database(i.database), this.databases.push(s)), !t.view.camera)
869
870
  return t;
870
871
  let r;
871
- if (this.webrender instanceof S) {
872
- const o = t.view.camera.split("/"), u = o.length === 2 ? o[0] : void 0, m = o.length === 2 ? o[1] : o[0];
873
- r = s.getCameraId(m, u);
874
- } else this.webrender instanceof l && (r = typeof t.view.camera == "string" ? t.view.camera : t.view.camera.id);
872
+ if (this.webrender instanceof F) {
873
+ const o = t.view.camera.split("/"), u = o.length === 2 ? o[0] : void 0, l = o.length === 2 ? o[1] : o[0];
874
+ r = s.getCameraId(l, u);
875
+ } else this.webrender instanceof m && (r = typeof t.view.camera == "string" ? t.view.camera : t.view.camera.id);
875
876
  if (!r)
876
877
  return t;
877
878
  const a = s.getCameraById(r);
878
879
  if (!a)
879
880
  return t;
880
- const n = L.initCubeFace(a.pointOfView.eye, a.pointOfView.target, e);
881
+ const n = S.initCubeFace(a.pointOfView.eye, a.pointOfView.target, e);
881
882
  return {
882
883
  ...t,
883
884
  view: {
@@ -932,7 +933,7 @@ class D {
932
933
  return e.protocol === "http:" || e.protocol === "https:";
933
934
  }
934
935
  }
935
- class Y {
936
+ class Q {
936
937
  constructor() {
937
938
  this.element = document.createElement("video"), this.element.classList.add("ls-viewer-video"), this.element.style.opacity = "0", this.element.width = 0, this.element.height = 0, this.element.setAttribute("muted", ""), this.element.setAttribute("playsinline", ""), this.element.setAttribute("preload", "auto");
938
939
  }
@@ -943,7 +944,7 @@ class Y {
943
944
  this.element.style.opacity = "0";
944
945
  }
945
946
  resize(t, e, i, s) {
946
- const r = p.fit(i, new b(t, e), s);
947
+ const r = b.fit(i, new y(t, e), s);
947
948
  this.element.style.top = `${r.top}px`, this.element.style.left = `${r.left}px`, this.element.style.width = `${r.width}px`, this.element.style.height = `${r.height}px`, (i.width !== this.element.width || i.height !== this.element.height) && (this.element.width = i.width, this.element.height = i.height);
948
949
  }
949
950
  }
@@ -975,11 +976,11 @@ class J {
975
976
  ) : this.hotspotList = []), this.hotspotsHash = n, this.snapshotHash = a, r;
976
977
  }
977
978
  async pick(t, e) {
978
- const i = new b(t.parameters.width, t.parameters.height), s = p.unproject(i, this.canvas.resolution, this.canvas.fit, e);
979
+ const i = new y(t.parameters.width, t.parameters.height), s = b.unproject(i, this.canvas.resolution, this.canvas.fit, e);
979
980
  return this.loader.loadImagePick(t, s);
980
981
  }
981
982
  hotspots(t) {
982
- return this.hotspotList.map((e) => ({ ...e, position2D: p.project(t, this.canvas.resolution, this.canvas.fit, e.position2D) })).map((e) => ({ ...e, visibility: p.contains(this.canvas.resolution, e.position2D) ? e.visibility : "OutOfFrustum" }));
983
+ return this.hotspotList.map((e) => ({ ...e, position2D: b.project(t, this.canvas.resolution, this.canvas.fit, e.position2D) })).map((e) => ({ ...e, visibility: b.contains(this.canvas.resolution, e.position2D) ? e.visibility : "OutOfFrustum" }));
983
984
  }
984
985
  snapshot(t, e) {
985
986
  return this.canvas.element.toDataURL(t, e);
@@ -1001,24 +1002,24 @@ class J {
1001
1002
  onDeviceOrientation(t) {
1002
1003
  }
1003
1004
  }
1004
- class I {
1005
+ class L {
1005
1006
  constructor(t, e) {
1006
1007
  this.x = t, this.y = e;
1007
1008
  }
1008
1009
  clone() {
1009
- return new I(this.x, this.y);
1010
+ return new L(this.x, this.y);
1010
1011
  }
1011
1012
  }
1012
- class y {
1013
+ class f {
1013
1014
  static pointFromMouseEvent(t) {
1014
- return new I(t.screenX, t.screenY);
1015
+ return new L(t.screenX, t.screenY);
1015
1016
  }
1016
1017
  static pointFromTouchEvent(t) {
1017
1018
  const e = t.targetTouches[0] || t.changedTouches[0];
1018
- return new I(e.screenX, e.screenY);
1019
+ return new L(e.screenX, e.screenY);
1019
1020
  }
1020
1021
  }
1021
- class V {
1022
+ class j {
1022
1023
  constructor(...t) {
1023
1024
  t.length === 3 ? ({ 0: this.u, 1: this.v, 2: this.o } = t, this.w = h.cross(this.u, this.v)) : t.length === 4 ? { 0: this.u, 1: this.v, 2: this.w, 3: this.o } = t : (this.u = [1, 0, 0], this.v = [0, 1, 0], this.w = [0, 0, 1], this.o = [0, 0, 0]);
1024
1025
  }
@@ -1035,9 +1036,9 @@ class Z {
1035
1036
  this.x = t, this.y = e, this.time = i;
1036
1037
  }
1037
1038
  }
1038
- class q {
1039
+ class R {
1039
1040
  constructor(t) {
1040
- this.points = [], this.onMotion = t, this.lastPoint = new I(0, 0), this.velocity = new I(0, 0), this.loop = this.loop.bind(this);
1041
+ this.points = [], this.onMotion = t, this.lastPoint = new L(0, 0), this.velocity = new L(0, 0), this.loop = this.loop.bind(this);
1041
1042
  }
1042
1043
  destroy() {
1043
1044
  this.animationFrameId && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = void 0);
@@ -1050,7 +1051,7 @@ class q {
1050
1051
  if (this.points.length === 0)
1051
1052
  return;
1052
1053
  const t = this.points[0], e = this.points[this.points.length - 1], i = e.x - t.x, s = e.y - t.y, r = e.time - t.time;
1053
- this.velocity = new I(r === 0 ? 0 : i / (r / 15), r === 0 ? 0 : s / (r / 15)), this.animationFrameId && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = void 0), this.animationFrameId = requestAnimationFrame(this.loop);
1054
+ this.velocity = new L(r === 0 ? 0 : i / (r / 15), r === 0 ? 0 : s / (r / 15)), this.animationFrameId && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = void 0), this.animationFrameId = requestAnimationFrame(this.loop);
1054
1055
  }
1055
1056
  stop() {
1056
1057
  this.animationFrameId && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = void 0), this.points = [];
@@ -1063,18 +1064,18 @@ class q {
1063
1064
  this.lastPoint.x += this.velocity.x, this.lastPoint.y += this.velocity.y, this.velocity.x *= 0.9, this.velocity.y *= 0.9, this.onMotion(this.lastPoint.clone()), this.animationFrameId = requestAnimationFrame(this.loop);
1064
1065
  }
1065
1066
  }
1066
- class Q {
1067
+ class W {
1067
1068
  constructor(t, e, i) {
1068
- this.isStarted = !1, this.pov = t, this.fov = w.degreesToRadians(e), this.orientationMatrix = c.identity(), this.inertia = new q(this.motion.bind(this)), this.onMotion = i, this.initPov = this.pov, this.initFov = this.fov, this.initOrientation = w.degreesToRadians(window.orientation) || 0, this.startPov = new L([0, 0, 1], [0, 0, 0], [0, 1, 0]), this.startSize = { width: 0, height: 0 }, this.previousPoint = new I(0, 0);
1069
+ this.isStarted = !1, this.pov = t, this.fov = w.degreesToRadians(e), this.orientationMatrix = c.identity(), this.inertia = new R(this.motion.bind(this)), this.onMotion = i, this.initPov = this.pov, this.initFov = this.fov, this.initOrientation = w.degreesToRadians(window.orientation) || 0, this.startPov = new S([0, 0, 1], [0, 0, 0], [0, 1, 0]), this.startSize = { width: 0, height: 0 }, this.previousPoint = new L(0, 0);
1069
1070
  }
1070
1071
  destroy() {
1071
1072
  this.inertia.destroy();
1072
1073
  }
1073
1074
  get orientedPov() {
1074
- const t = h.normalize(h.cross(this.pov.up, this.pov.target)), e = new V(t, [0, 1, 0], this.pov.eye), i = c.identity();
1075
+ const t = h.normalize(h.cross(this.pov.up, this.pov.target)), e = new j(t, [0, 1, 0], this.pov.eye), i = c.identity();
1075
1076
  c.multiply(i, e.localToGlobalMatrix, i), c.multiply(i, this.orientationMatrix, i), c.multiply(i, e.globalToLocalMatrix, i);
1076
1077
  const s = c.transformDirection(i, this.pov.target), r = this.pov.eye, a = c.transformDirection(i, this.pov.up);
1077
- return new L(s, r, a);
1078
+ return new S(s, r, a);
1078
1079
  }
1079
1080
  reset() {
1080
1081
  this.pov = this.initPov.clone(), this.fov = this.initFov;
@@ -1087,10 +1088,10 @@ class Q {
1087
1088
  const e = {
1088
1089
  x: t.x - this.previousPoint.x,
1089
1090
  y: t.y - this.previousPoint.y
1090
- }, i = w.accelerate(e.x, 1.3) / this.startSize.width * 0.2 * Math.PI * 1.5, s = w.accelerate(e.y, 1.3) / this.startSize.height * 0.2 * Math.PI, r = c.multiply(c.rotationY(i), c.rotationX(-s)), a = h.normalize(h.cross(this.pov.up, this.pov.target)), n = new V(a, [0, 1, 0], this.pov.eye), o = c.identity();
1091
+ }, i = w.accelerate(e.x, 1.3) / this.startSize.width * 0.2 * Math.PI * 1.5, s = w.accelerate(e.y, 1.3) / this.startSize.height * 0.2 * Math.PI, r = c.multiply(c.rotationY(i), c.rotationX(-s)), a = h.normalize(h.cross(this.pov.up, this.pov.target)), n = new j(a, [0, 1, 0], this.pov.eye), o = c.identity();
1091
1092
  c.multiply(o, n.localToGlobalMatrix, o), c.multiply(o, r, o), c.multiply(o, n.globalToLocalMatrix, o);
1092
- const u = c.transformPoint(o, this.pov.target), m = c.transformDirection(o, this.pov.up);
1093
- h.cross(m, [0, 0, 1])[0] >= 0 && (this.pov.target = u, this.pov.up = m), this.previousPoint = t, this.onMotion();
1093
+ const u = c.transformPoint(o, this.pov.target), l = c.transformDirection(o, this.pov.up);
1094
+ h.cross(l, [0, 0, 1])[0] >= 0 && (this.pov.target = u, this.pov.up = l), this.previousPoint = t, this.onMotion();
1094
1095
  }
1095
1096
  end(t, e) {
1096
1097
  this.isStarted = !1, e && (this.inertia.track(t), this.inertia.start());
@@ -1100,7 +1101,7 @@ class Q {
1100
1101
  c.rotateZ(o, this.initOrientation, o), c.rotateZ(o, r, o), c.rotateX(o, a, o), c.rotateY(o, n, o), c.rotateZ(o, -s, o), this.orientationMatrix = o, this.onMotion();
1101
1102
  }
1102
1103
  }
1103
- var W = `precision mediump float;
1104
+ var _ = `precision mediump float;
1104
1105
 
1105
1106
  uniform float u_mix;
1106
1107
  uniform samplerCube u_texture;
@@ -1112,7 +1113,7 @@ void main() {
1112
1113
  vec4 backColor = textureCube(u_texture_back, direction);
1113
1114
  vec4 color = textureCube(u_texture, direction);
1114
1115
  gl_FragColor = mix(backColor, color, u_mix);
1115
- }`, _ = `attribute vec4 position;
1116
+ }`, K = `attribute vec4 position;
1116
1117
 
1117
1118
  uniform mat4 u_mvpi;
1118
1119
 
@@ -1122,27 +1123,27 @@ void main() {
1122
1123
  direction = (u_mvpi * position).xyz;
1123
1124
  gl_Position = position;
1124
1125
  }`;
1125
- class K {
1126
- constructor(t, e, i, s) {
1127
- this.container = t, this.canvas = e, this.loader = i, this.images = [], this.hotspotsList = [[]];
1128
- const r = new L([0, 0, 1], [0, 0, 0], [0, 1, 0]), a = 60, n = c.rotationX(w.degreesToRadians(15));
1129
- c.transformDirection(n, r.target, r.target), c.transformDirection(n, r.up, r.up), this.interaction = new Q(r, a, () => {
1126
+ class tt {
1127
+ constructor(t, e, i, s, r) {
1128
+ this.container = t, this.canvas = e, this.loader = i, this.aspectRatioOverride = r, this.images = [], this.hotspotsList = [[]];
1129
+ const a = new S([0, 0, 1], [0, 0, 0], [0, 1, 0]), n = 60, o = c.rotationX(w.degreesToRadians(15));
1130
+ c.transformDirection(o, a.target, a.target), c.transformDirection(o, a.up, a.up), this.interaction = new W(a, n, () => {
1130
1131
  this.animationFrameId = requestAnimationFrame(this.render), this.onInteraction({
1131
1132
  pov: this.interaction.pov.clone(),
1132
1133
  fov: this.interaction.fov
1133
1134
  });
1134
- }), this.onInteraction = s, this.gl = this.canvas.context, this.programInfo = P.createProgramInfo(this.gl, [`${_}
1135
- `, `${W}
1136
- `]), this.quad = P.primitives.createXYQuadBufferInfo(this.gl), this.uniforms = {
1135
+ }), this.onInteraction = s, this.gl = this.canvas.context, this.programInfo = M.createProgramInfo(this.gl, [`${K}
1136
+ `, `${_}
1137
+ `]), this.quad = M.primitives.createXYQuadBufferInfo(this.gl), this.uniforms = {
1137
1138
  u_mvpi: c.identity(),
1138
1139
  u_mix: 0,
1139
- u_texture_back: P.createTexture(this.gl, {
1140
+ u_texture_back: M.createTexture(this.gl, {
1140
1141
  target: this.gl.TEXTURE_CUBE_MAP,
1141
1142
  minMag: this.gl.LINEAR,
1142
1143
  width: 1,
1143
1144
  height: 1
1144
1145
  }),
1145
- u_texture: P.createTexture(this.gl, {
1146
+ u_texture: M.createTexture(this.gl, {
1146
1147
  target: this.gl.TEXTURE_CUBE_MAP,
1147
1148
  minMag: this.gl.LINEAR,
1148
1149
  width: 1,
@@ -1180,7 +1181,7 @@ class K {
1180
1181
  const a = JSON.stringify(t);
1181
1182
  a === this.snapshotHash ? r = r.then(() => (this.animationFrameId = requestAnimationFrame(this.render), Promise.resolve())) : (this.images = [], this.animationFrameId = requestAnimationFrame(this.render), r = r.then(
1182
1183
  () => this.loader.loadVRCubeSnapshot(t).then((o) => {
1183
- this.images = o, P.createTexture(
1184
+ this.images = o, M.createTexture(
1184
1185
  this.gl,
1185
1186
  {
1186
1187
  target: this.gl.TEXTURE_CUBE_MAP,
@@ -1197,8 +1198,8 @@ class K {
1197
1198
  ],
1198
1199
  src: o
1199
1200
  },
1200
- (u, m) => {
1201
- u || (i && this.interaction.reset(), this.uniforms.u_mix = s ? 0 : 1, this.uniforms.u_texture_back = this.uniforms.u_texture, this.uniforms.u_texture = m, this.animationFrameId = requestAnimationFrame(this.render));
1201
+ (u, l) => {
1202
+ u || (i && this.interaction.reset(), this.uniforms.u_mix = s ? 0 : 1, this.uniforms.u_texture_back = this.uniforms.u_texture, this.uniforms.u_texture = l, this.animationFrameId = requestAnimationFrame(this.render));
1202
1203
  }
1203
1204
  );
1204
1205
  })
@@ -1211,35 +1212,35 @@ class K {
1211
1212
  ) : this.hotspotsList = [[]]), this.hotspotsHash = n, this.snapshotHash = a, r;
1212
1213
  }
1213
1214
  async pick(t, e) {
1214
- const i = this.canvas.element.clientWidth, s = this.canvas.element.clientHeight, r = e.x, a = s - e.y, n = 2 * r / i - 1, o = 2 * a / s - 1, u = [n, o, 0], m = this.modelViewProjectionMatrix, f = c.inverse(m), d = h.normalize(c.transformPoint(f, u)), T = Math.max(Math.abs(d[0]), Math.abs(d[1]), Math.abs(d[2]));
1215
- let F = "";
1216
- Math.abs(d[0]) === T ? F = d[0] > 0 ? "XPOS" : "XNEG" : Math.abs(d[1]) === T ? F = d[1] > 0 ? "YPOS" : "YNEG" : F = d[2] > 0 ? "ZPOS" : "ZNEG";
1217
- let x = 0, M = 0, E = "";
1218
- switch (F) {
1215
+ const i = this.canvas.element.clientWidth, s = this.canvas.element.clientHeight, r = e.x, a = s - e.y, n = 2 * r / i - 1, o = 2 * a / s - 1, u = [n, o, 0], l = this.modelViewProjectionMatrix, p = c.inverse(l), d = h.normalize(c.transformPoint(p, u)), C = Math.max(Math.abs(d[0]), Math.abs(d[1]), Math.abs(d[2]));
1216
+ let A = "";
1217
+ Math.abs(d[0]) === C ? A = d[0] > 0 ? "XPOS" : "XNEG" : Math.abs(d[1]) === C ? A = d[1] > 0 ? "YPOS" : "YNEG" : A = d[2] > 0 ? "ZPOS" : "ZNEG";
1218
+ let x = 0, E = 0, I = "";
1219
+ switch (A) {
1219
1220
  case "XPOS":
1220
- x = (-d[2] / Math.abs(d[0]) + 1) / 2, M = (-d[1] / Math.abs(d[0]) + 1) / 2, E = "right";
1221
+ x = (-d[2] / Math.abs(d[0]) + 1) / 2, E = (-d[1] / Math.abs(d[0]) + 1) / 2, I = "right";
1221
1222
  break;
1222
1223
  case "XNEG":
1223
- x = (d[2] / Math.abs(d[0]) + 1) / 2, M = (-d[1] / Math.abs(d[0]) + 1) / 2, E = "left";
1224
+ x = (d[2] / Math.abs(d[0]) + 1) / 2, E = (-d[1] / Math.abs(d[0]) + 1) / 2, I = "left";
1224
1225
  break;
1225
1226
  case "YPOS":
1226
- x = (d[0] / Math.abs(d[1]) + 1) / 2, M = (d[2] / Math.abs(d[1]) + 1) / 2, E = "up";
1227
+ x = (d[0] / Math.abs(d[1]) + 1) / 2, E = (d[2] / Math.abs(d[1]) + 1) / 2, I = "up";
1227
1228
  break;
1228
1229
  case "YNEG":
1229
- x = (d[0] / Math.abs(d[1]) + 1) / 2, M = (-d[2] / Math.abs(d[1]) + 1) / 2, E = "down";
1230
+ x = (d[0] / Math.abs(d[1]) + 1) / 2, E = (-d[2] / Math.abs(d[1]) + 1) / 2, I = "down";
1230
1231
  break;
1231
1232
  case "ZPOS":
1232
- x = (d[0] / Math.abs(d[2]) + 1) / 2, M = (-d[1] / Math.abs(d[2]) + 1) / 2, E = "front";
1233
+ x = (d[0] / Math.abs(d[2]) + 1) / 2, E = (-d[1] / Math.abs(d[2]) + 1) / 2, I = "front";
1233
1234
  break;
1234
1235
  case "ZNEG":
1235
- x = (-d[0] / Math.abs(d[2]) + 1) / 2, M = (-d[1] / Math.abs(d[2]) + 1) / 2, E = "back";
1236
+ x = (-d[0] / Math.abs(d[2]) + 1) / 2, E = (-d[1] / Math.abs(d[2]) + 1) / 2, I = "back";
1236
1237
  break;
1237
1238
  }
1238
- const O = {
1239
+ const T = {
1239
1240
  x: Math.round(x * Math.max(t.parameters.width, t.parameters.height)),
1240
- y: Math.round(M * Math.max(t.parameters.width, t.parameters.height))
1241
+ y: Math.round(E * Math.max(t.parameters.width, t.parameters.height))
1241
1242
  };
1242
- return this.loader.loadVRCubePick(t, O, E);
1243
+ return this.loader.loadVRCubePick(t, T, I);
1243
1244
  }
1244
1245
  hotspots() {
1245
1246
  const t = [];
@@ -1247,36 +1248,36 @@ class K {
1247
1248
  return [];
1248
1249
  const e = this.hotspotsList[0]?.length ?? 0, i = this.modelViewProjectionMatrix;
1249
1250
  for (let s = 0; s < e; s++) {
1250
- const r = this.hotspotsList.findIndex((R) => R[s].visibility !== "OutOfFrustum");
1251
+ const r = this.hotspotsList.findIndex(($) => $[s].visibility !== "OutOfFrustum");
1251
1252
  if (r === -1)
1252
1253
  continue;
1253
1254
  const a = { ...this.hotspotsList[r][s] }, n = a.position2D.x / this.images[0].width, o = a.position2D.y / this.images[0].height;
1254
- let u = 0, m = 0, f = 0;
1255
+ let u = 0, l = 0, p = 0;
1255
1256
  switch (r) {
1256
1257
  case 0:
1257
- this.pov.target[2] < 0 && (a.visibility = "OutOfFrustum"), u = 2 * n - 1, m = 1 - 2 * o, f = 1;
1258
+ this.pov.target[2] < 0 && (a.visibility = "OutOfFrustum"), u = 2 * n - 1, l = 1 - 2 * o, p = 1;
1258
1259
  break;
1259
1260
  case 1:
1260
- this.pov.target[0] > 0 && (a.visibility = "OutOfFrustum"), u = 1, m = 1 - 2 * o, f = 1 - 2 * n;
1261
+ this.pov.target[0] > 0 && (a.visibility = "OutOfFrustum"), u = 1, l = 1 - 2 * o, p = 1 - 2 * n;
1261
1262
  break;
1262
1263
  case 2:
1263
- this.pov.target[2] > 0 && (a.visibility = "OutOfFrustum"), u = 1 - 2 * n, m = 1 - 2 * o, f = -1;
1264
+ this.pov.target[2] > 0 && (a.visibility = "OutOfFrustum"), u = 1 - 2 * n, l = 1 - 2 * o, p = -1;
1264
1265
  break;
1265
1266
  case 3:
1266
- this.pov.target[0] < 0 && (a.visibility = "OutOfFrustum"), u = -1, m = 1 - 2 * o, f = 2 * n - 1;
1267
+ this.pov.target[0] < 0 && (a.visibility = "OutOfFrustum"), u = -1, l = 1 - 2 * o, p = 2 * n - 1;
1267
1268
  break;
1268
1269
  case 4:
1269
- this.pov.target[1] < 0 && (a.visibility = "OutOfFrustum"), u = 2 * n - 1, m = 1, f = 2 * o - 1;
1270
+ this.pov.target[1] < 0 && (a.visibility = "OutOfFrustum"), u = 2 * n - 1, l = 1, p = 2 * o - 1;
1270
1271
  break;
1271
1272
  case 5:
1272
- this.pov.target[1] > 0 && (a.visibility = "OutOfFrustum"), u = 2 * n - 1, m = -1, f = 1 - 2 * o;
1273
+ this.pov.target[1] > 0 && (a.visibility = "OutOfFrustum"), u = 2 * n - 1, l = -1, p = 1 - 2 * o;
1273
1274
  break;
1274
1275
  }
1275
- const d = h.normalize([u, m, f]), T = c.transformPoint(i, d), F = this.canvas.element.clientWidth, x = this.canvas.element.clientHeight, M = 0.5 * F * (T[0] + 1), E = 0.5 * x * (T[1] + 1), O = {
1276
- x: Math.round(M),
1277
- y: Math.round(x - E)
1278
- }, G = new b(F, x), z = p.contains(G, O) ? a.visibility : "OutOfFrustum";
1279
- t.push({ ...a, position2D: O, visibility: z });
1276
+ const d = h.normalize([u, l, p]), C = c.transformPoint(i, d), A = this.canvas.element.clientWidth, x = this.canvas.element.clientHeight, E = 0.5 * A * (C[0] + 1), I = 0.5 * x * (C[1] + 1), T = {
1277
+ x: Math.round(E),
1278
+ y: Math.round(x - I)
1279
+ }, G = new y(A, x), z = b.contains(G, T) ? a.visibility : "OutOfFrustum";
1280
+ t.push({ ...a, position2D: T, visibility: z });
1280
1281
  }
1281
1282
  return t;
1282
1283
  }
@@ -1284,46 +1285,46 @@ class K {
1284
1285
  return this.canvas.element.toDataURL(t, e);
1285
1286
  }
1286
1287
  get modelViewProjectionMatrix() {
1287
- const t = this.canvas.element.clientWidth, e = this.canvas.element.clientHeight, i = t > e ? t / e : e / t, s = p.getStandardAspectRatio(t, e), r = this.interaction.fov * (s / i), a = c.setAxis(c.identity(), [-1, 0, 0], 0), n = t > e ? w.perspectiveWithFovY(r, t / e, 0.5, 100) : w.perspectiveWithFovX(r, t / e, 0.5, 100), o = this.interaction.orientedPov, u = c.inverse(c.lookAt(o.eye, o.target, o.up));
1288
+ const t = this.canvas.element.clientWidth, e = this.canvas.element.clientHeight, i = t > e ? t / e : e / t, s = b.getStandardAspectRatio(t, e, this.aspectRatioOverride), r = this.interaction.fov * (s / i), a = c.setAxis(c.identity(), [-1, 0, 0], 0), n = t > e ? w.perspectiveWithFovY(r, t / e, 0.5, 100) : w.perspectiveWithFovX(r, t / e, 0.5, 100), o = this.interaction.orientedPov, u = c.inverse(c.lookAt(o.eye, o.target, o.up));
1288
1289
  return c.multiply(c.multiply(n, u), a);
1289
1290
  }
1290
1291
  render() {
1291
- this.gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height), this.uniforms.u_mvpi = c.inverse(this.modelViewProjectionMatrix), this.gl.useProgram(this.programInfo.program), P.setBuffersAndAttributes(this.gl, this.programInfo, this.quad), P.setUniforms(this.programInfo, this.uniforms), P.drawBufferInfo(this.gl, this.quad), this.uniforms.u_mix < 1 && (this.uniforms.u_mix = Math.min(this.uniforms.u_mix + 0.05, 1), this.animationFrameId = requestAnimationFrame(this.render));
1292
+ this.gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height), this.uniforms.u_mvpi = c.inverse(this.modelViewProjectionMatrix), this.gl.useProgram(this.programInfo.program), M.setBuffersAndAttributes(this.gl, this.programInfo, this.quad), M.setUniforms(this.programInfo, this.uniforms), M.drawBufferInfo(this.gl, this.quad), this.uniforms.u_mix < 1 && (this.uniforms.u_mix = Math.min(this.uniforms.u_mix + 0.05, 1), this.animationFrameId = requestAnimationFrame(this.render));
1292
1293
  }
1293
1294
  onMouseDown(t) {
1294
- this.container.classList.add("ls-viewer-container-vrcube-grabbing"), this.interaction.start(y.pointFromMouseEvent(t), {
1295
+ this.container.classList.add("ls-viewer-container-vrcube-grabbing"), this.interaction.start(f.pointFromMouseEvent(t), {
1295
1296
  width: this.gl.canvas.width,
1296
1297
  height: this.gl.canvas.height
1297
1298
  });
1298
1299
  }
1299
1300
  onMouseMove(t) {
1300
- this.interaction.isStarted && (this.interaction.motion(y.pointFromMouseEvent(t)), t.preventDefault());
1301
+ this.interaction.isStarted && (this.interaction.motion(f.pointFromMouseEvent(t)), t.preventDefault());
1301
1302
  }
1302
1303
  onMouseUp(t) {
1303
- this.interaction.isStarted && (this.container.classList.remove("ls-viewer-container-vrcube-grabbing"), this.interaction.end(y.pointFromMouseEvent(t), !0));
1304
+ this.interaction.isStarted && (this.container.classList.remove("ls-viewer-container-vrcube-grabbing"), this.interaction.end(f.pointFromMouseEvent(t), !0));
1304
1305
  }
1305
1306
  onMouseEnter(t) {
1306
- this.interaction.isStarted && t.buttons === 0 && (this.container.classList.remove("ls-viewer-container-vrcube-grabbing"), this.interaction.end(y.pointFromMouseEvent(t), !1));
1307
+ this.interaction.isStarted && t.buttons === 0 && (this.container.classList.remove("ls-viewer-container-vrcube-grabbing"), this.interaction.end(f.pointFromMouseEvent(t), !1));
1307
1308
  }
1308
1309
  onTouchStart(t) {
1309
- this.container.classList.add("ls-viewer-container-vrcube-grabbing"), this.interaction.start(y.pointFromTouchEvent(t), {
1310
+ this.container.classList.add("ls-viewer-container-vrcube-grabbing"), this.interaction.start(f.pointFromTouchEvent(t), {
1310
1311
  width: this.gl.canvas.width,
1311
1312
  height: this.gl.canvas.height
1312
1313
  });
1313
1314
  }
1314
1315
  onTouchMove(t) {
1315
- this.interaction.isStarted && (this.interaction.motion(y.pointFromTouchEvent(t)), t.preventDefault());
1316
+ this.interaction.isStarted && (this.interaction.motion(f.pointFromTouchEvent(t)), t.preventDefault());
1316
1317
  }
1317
1318
  onTouchEnd(t) {
1318
- this.interaction.isStarted && (this.container.classList.remove("ls-viewer-container-vrcube-grabbing"), this.interaction.end(y.pointFromTouchEvent(t), !0));
1319
+ this.interaction.isStarted && (this.container.classList.remove("ls-viewer-container-vrcube-grabbing"), this.interaction.end(f.pointFromTouchEvent(t), !0));
1319
1320
  }
1320
1321
  onDeviceOrientation(t) {
1321
1322
  this.interaction.orientation(t.alpha, t.beta, t.gamma);
1322
1323
  }
1323
1324
  }
1324
- class tt {
1325
+ class et {
1325
1326
  constructor(t, e, i, s, r) {
1326
- this.isStarted = !1, this.position = t, this.frames = e, this.rows = i, this.loop = s, this.onMotion = r, this.inertia = new q(this.motion.bind(this)), this.initPosition = { ...this.position }, this.startPosition = { x: 0, y: 0 }, this.startPoint = new I(0, 0), this.startSize = { width: 0, height: 0 }, this.lastPoints = [], this.lastPointsNumber = 20;
1327
+ this.isStarted = !1, this.position = t, this.frames = e, this.rows = i, this.loop = s, this.onMotion = r, this.inertia = new R(this.motion.bind(this)), this.initPosition = { ...this.position }, this.startPosition = { x: 0, y: 0 }, this.startPoint = new L(0, 0), this.startSize = { width: 0, height: 0 }, this.lastPoints = [], this.lastPointsNumber = 20;
1327
1328
  }
1328
1329
  destroy() {
1329
1330
  this.inertia.destroy();
@@ -1345,7 +1346,7 @@ class tt {
1345
1346
  }
1346
1347
  motion(t) {
1347
1348
  this.isStarted && this.inertia.track(t), this.lastPoints.push({ x: t.x, y: t.y }), this.lastPoints.splice(0, this.lastPoints.length - this.lastPointsNumber);
1348
- const e = $.linear(this.lastPoints.map((s) => [s.x, s.y])), i = 25;
1349
+ const e = U.linear(this.lastPoints.map((s) => [s.x, s.y])), i = 25;
1349
1350
  if (Math.abs(e.equation[0]) < 1) {
1350
1351
  const s = w.accelerate(t.x - this.startPoint.x, 1.3) / this.startSize.width * (this.frames / 4);
1351
1352
  let r = this.startPosition.x - Math.round(s);
@@ -1366,7 +1367,7 @@ class tt {
1366
1367
  }
1367
1368
  class k {
1368
1369
  constructor(t, e, i, s) {
1369
- this.container = t, this.canvas = e, this.loader = i, this.images = [], this.frames = 24, this.hotspotsList = [[]], this.interaction = new tt({ x: 0, y: 0 }, 1, 1, !1, () => {
1370
+ this.container = t, this.canvas = e, this.loader = i, this.images = [], this.frames = 24, this.hotspotsList = [[]], this.interaction = new et({ x: 0, y: 0 }, 1, 1, !1, () => {
1370
1371
  this.canvas.draw(this.image, !0, 0.5), this.onInteraction({
1371
1372
  position: this.interaction.positionIndex
1372
1373
  });
@@ -1411,9 +1412,9 @@ class k {
1411
1412
  a === this.snapshotHash && this.image ? r = r.then(() => this.canvas.draw(this.image, s, 0.05)) : (this.images = [], r = r.then(
1412
1413
  () => this.loader.loadVRObjectSnapshot(t, this.interaction.positionIndex).then((o) => {
1413
1414
  const u = o.length;
1414
- return this.images = new Array(u), this.interaction.frames = t.view.frames ?? t.view.panFrames ?? this.frames, this.interaction.rows = u / this.interaction.frames, this.interaction.loop = !!t.view.loop, i && this.interaction.reset(), o.forEach((m, f) => {
1415
- m.then((d) => {
1416
- this.images[f] = d, d === this.image && this.canvas.draw(this.image, s, 0.05);
1415
+ return this.images = new Array(u), this.interaction.frames = t.view.frames ?? t.view.panFrames ?? this.frames, this.interaction.rows = u / this.interaction.frames, this.interaction.loop = !!t.view.loop, i && this.interaction.reset(), o.forEach((l, p) => {
1416
+ l.then((d) => {
1417
+ this.images[p] = d, d === this.image && this.canvas.draw(this.image, s, 0.05);
1417
1418
  }).catch(() => {
1418
1419
  });
1419
1420
  }), o[this.interaction.positionIndex].then(() => Promise.resolve());
@@ -1427,46 +1428,46 @@ class k {
1427
1428
  ) : this.hotspotsList = [[]]), this.hotspotsHash = n, this.snapshotHash = a, r;
1428
1429
  }
1429
1430
  async pick(t, e) {
1430
- const i = new b(t.parameters.width, t.parameters.height), s = p.unproject(i, this.canvas.resolution, this.canvas.fit, e);
1431
+ const i = new y(t.parameters.width, t.parameters.height), s = b.unproject(i, this.canvas.resolution, this.canvas.fit, e);
1431
1432
  return this.loader.loadVRObjectPick(t, s, this.position, this.frames);
1432
1433
  }
1433
1434
  hotspots(t) {
1434
- return (this.hotspotsList[this.interaction.positionIndex] || []).map((i) => ({ ...i, position2D: p.project(t, this.canvas.resolution, this.canvas.fit, i.position2D) })).map((i) => ({ ...i, visibility: p.contains(this.canvas.resolution, i.position2D) ? i.visibility : "OutOfFrustum" }));
1435
+ return (this.hotspotsList[this.interaction.positionIndex] || []).map((i) => ({ ...i, position2D: b.project(t, this.canvas.resolution, this.canvas.fit, i.position2D) })).map((i) => ({ ...i, visibility: b.contains(this.canvas.resolution, i.position2D) ? i.visibility : "OutOfFrustum" }));
1435
1436
  }
1436
1437
  snapshot(t, e) {
1437
1438
  return this.canvas.element.toDataURL(t, e);
1438
1439
  }
1439
1440
  onMouseDown(t) {
1440
- this.container.classList.add("ls-viewer-container-vrobject-grabbing"), this.interaction.start(y.pointFromMouseEvent(t), {
1441
+ this.container.classList.add("ls-viewer-container-vrobject-grabbing"), this.interaction.start(f.pointFromMouseEvent(t), {
1441
1442
  width: this.canvas.element.width,
1442
1443
  height: this.canvas.element.height
1443
1444
  });
1444
1445
  }
1445
1446
  onMouseMove(t) {
1446
- this.interaction.isStarted && (this.interaction.motion(y.pointFromMouseEvent(t)), t.preventDefault());
1447
+ this.interaction.isStarted && (this.interaction.motion(f.pointFromMouseEvent(t)), t.preventDefault());
1447
1448
  }
1448
1449
  onMouseUp(t) {
1449
- this.interaction.isStarted && (this.container.classList.remove("ls-viewer-container-vrobject-grabbing"), this.interaction.end(y.pointFromMouseEvent(t), !0));
1450
+ this.interaction.isStarted && (this.container.classList.remove("ls-viewer-container-vrobject-grabbing"), this.interaction.end(f.pointFromMouseEvent(t), !0));
1450
1451
  }
1451
1452
  onMouseEnter(t) {
1452
- this.interaction.isStarted && t.buttons === 0 && (this.container.classList.remove("ls-viewer-container-vrobject-grabbing"), this.interaction.end(y.pointFromMouseEvent(t), !1));
1453
+ this.interaction.isStarted && t.buttons === 0 && (this.container.classList.remove("ls-viewer-container-vrobject-grabbing"), this.interaction.end(f.pointFromMouseEvent(t), !1));
1453
1454
  }
1454
1455
  onTouchStart(t) {
1455
- this.container.classList.add("ls-viewer-container-vrobject-grabbing"), this.interaction.start(y.pointFromTouchEvent(t), {
1456
+ this.container.classList.add("ls-viewer-container-vrobject-grabbing"), this.interaction.start(f.pointFromTouchEvent(t), {
1456
1457
  width: this.canvas.element.width,
1457
1458
  height: this.canvas.element.height
1458
1459
  });
1459
1460
  }
1460
1461
  onTouchMove(t) {
1461
- this.interaction.isStarted && (this.interaction.motion(y.pointFromTouchEvent(t)), t.preventDefault());
1462
+ this.interaction.isStarted && (this.interaction.motion(f.pointFromTouchEvent(t)), t.preventDefault());
1462
1463
  }
1463
1464
  onTouchEnd(t) {
1464
- this.interaction.isStarted && (this.container.classList.remove("ls-viewer-container-vrobject-grabbing"), this.interaction.end(y.pointFromTouchEvent(t), !0));
1465
+ this.interaction.isStarted && (this.container.classList.remove("ls-viewer-container-vrobject-grabbing"), this.interaction.end(f.pointFromTouchEvent(t), !0));
1465
1466
  }
1466
1467
  onDeviceOrientation(t) {
1467
1468
  }
1468
1469
  }
1469
- class et {
1470
+ class it {
1470
1471
  constructor(t, e, i) {
1471
1472
  this.container = t, this.loader = i, this.video = e;
1472
1473
  }
@@ -1519,9 +1520,9 @@ class et {
1519
1520
  onDeviceOrientation(t) {
1520
1521
  }
1521
1522
  }
1522
- class at {
1523
+ class nt {
1523
1524
  constructor(t, e) {
1524
- this.checkResize = this.checkResize.bind(this), this.onDeviceOrientation = this.onDeviceOrientation.bind(this), this.onResize = this.onResize.bind(this), this.onMouseDown = this.onMouseDown.bind(this), this.onMouseMove = this.onMouseMove.bind(this), this.onMouseUp = this.onMouseUp.bind(this), this.onMouseEnter = this.onMouseEnter.bind(this), this.onTouchStart = this.onTouchStart.bind(this), this.onTouchMove = this.onTouchMove.bind(this), this.onTouchEnd = this.onTouchEnd.bind(this), this.onLoadStart = this.onLoadStart.bind(this), this.onLoadProgress = this.onLoadProgress.bind(this), this.onLoadEnd = this.onLoadEnd.bind(this), this.onLoadError = this.onLoadError.bind(this), this.onHotspotsChange = this.onHotspotsChange.bind(this), this.onVrcubeInteraction = this.onVrcubeInteraction.bind(this), this.onVrobjectInteraction = this.onVrobjectInteraction.bind(this), this.options = {
1525
+ this.onDeviceOrientation = this.onDeviceOrientation.bind(this), this.onResize = this.onResize.bind(this), this.onMouseDown = this.onMouseDown.bind(this), this.onMouseMove = this.onMouseMove.bind(this), this.onMouseUp = this.onMouseUp.bind(this), this.onMouseEnter = this.onMouseEnter.bind(this), this.onTouchStart = this.onTouchStart.bind(this), this.onTouchMove = this.onTouchMove.bind(this), this.onTouchEnd = this.onTouchEnd.bind(this), this.onLoadStart = this.onLoadStart.bind(this), this.onLoadProgress = this.onLoadProgress.bind(this), this.onLoadEnd = this.onLoadEnd.bind(this), this.onLoadError = this.onLoadError.bind(this), this.onHotspotsChange = this.onHotspotsChange.bind(this), this.onVrcubeInteraction = this.onVrcubeInteraction.bind(this), this.onVrobjectInteraction = this.onVrobjectInteraction.bind(this), this.options = {
1525
1526
  server: "localhost",
1526
1527
  api: "v1",
1527
1528
  autores: !0,
@@ -1550,7 +1551,7 @@ class at {
1550
1551
  onHotspotsChange: () => {
1551
1552
  },
1552
1553
  ...e.events
1553
- }, this.options.events.onLoadError = C(this.options.events.onLoadError, 10), this.container = t, this.container.classList.add("ls-viewer-container"), this.containerWidth = 0, this.containerHeight = 0, this.canvas2D = new U(this.options.fit), this.container.prepend(this.canvas2D.element), this.canvas3D = new N(), this.container.prepend(this.canvas3D.element), this.video = new Y(), this.container.prepend(this.video.element), this.loader = new D(this.options.server, this.options.api, this), this.resolution = new b(0, 0), this.parameters = {
1554
+ }, this.options.events.onLoadError = V(this.options.events.onLoadError, 10), this.container = t, this.container.classList.add("ls-viewer-container"), this.canvas2D = new N(this.options.fit), this.container.prepend(this.canvas2D.element), this.canvas3D = new B(), this.container.prepend(this.canvas3D.element), this.video = new Q(), this.container.prepend(this.video.element), this.loader = new D(this.options.server, this.options.api, this), this.resolution = new y(0, 0), this.parameters = {
1554
1555
  width: 0,
1555
1556
  height: 0,
1556
1557
  antialiasing: !1,
@@ -1558,10 +1559,10 @@ class at {
1558
1559
  }, this.encoder = {
1559
1560
  format: "jpeg",
1560
1561
  quality: 80
1561
- }, this.hotspots = [], this.widgetImage = new J(t, this.canvas2D, this.loader), this.widgetVideo = new et(t, this.video, this.loader), this.widgetVRObject = new k(t, this.canvas2D, this.loader, this.onVrobjectInteraction), this.canvas3D.context && (this.widgetVRCube = new K(t, this.canvas3D, this.loader, this.onVrcubeInteraction)), this.widget = this.widgetImage, this.isDestroyed = !1, this.container.addEventListener("mousedown", this.onMouseDown), this.container.addEventListener("mouseenter", this.onMouseEnter), this.container.addEventListener("touchstart", this.onTouchStart), document.addEventListener("mousemove", this.onMouseMove, { passive: !1 }), document.addEventListener("mouseup", this.onMouseUp), document.addEventListener("touchmove", this.onTouchMove, { passive: !1 }), document.addEventListener("touchend", this.onTouchEnd), this.loadWidget = C(this.loadWidget, 10), this.onResize = C(this.onResize, 250), requestAnimationFrame(this.checkResize);
1562
+ }, this.hotspots = [], this.widgetImage = new J(t, this.canvas2D, this.loader), this.widgetVideo = new it(t, this.video, this.loader), this.widgetVRObject = new k(t, this.canvas2D, this.loader, this.onVrobjectInteraction), this.canvas3D.context && (this.widgetVRCube = new tt(t, this.canvas3D, this.loader, this.onVrcubeInteraction, this.aspectRatioOverride)), this.widget = this.widgetImage, this.container.addEventListener("mousedown", this.onMouseDown), this.container.addEventListener("mouseenter", this.onMouseEnter), this.container.addEventListener("touchstart", this.onTouchStart), document.addEventListener("mousemove", this.onMouseMove, { passive: !1 }), document.addEventListener("mouseup", this.onMouseUp), document.addEventListener("touchmove", this.onTouchMove, { passive: !1 }), document.addEventListener("touchend", this.onTouchEnd), this.loadWidget = V(this.loadWidget, 10), this.resizeObserver = new ResizeObserver(this.onResize), this.resizeObserver.observe(this.container);
1562
1563
  }
1563
1564
  destroy() {
1564
- this.canvas2D.destroy(), this.container.removeEventListener("mousedown", this.onMouseDown), this.container.removeEventListener("mouseenter", this.onMouseEnter), this.container.removeEventListener("touchstart", this.onTouchStart), document.removeEventListener("mousemove", this.onMouseMove), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("touchmove", this.onTouchMove), document.removeEventListener("touchend", this.onTouchEnd), this.isDestroyed = !0;
1565
+ this.resizeObserver.disconnect(), this.canvas2D.destroy(), this.container.removeEventListener("mousedown", this.onMouseDown), this.container.removeEventListener("mouseenter", this.onMouseEnter), this.container.removeEventListener("touchstart", this.onTouchStart), document.removeEventListener("mousemove", this.onMouseMove), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("touchmove", this.onTouchMove), document.removeEventListener("touchend", this.onTouchEnd);
1565
1566
  }
1566
1567
  async load(t, e) {
1567
1568
  let i = Promise.resolve();
@@ -1577,7 +1578,12 @@ class at {
1577
1578
  }), e;
1578
1579
  }
1579
1580
  setParameters(t) {
1580
- t.width && t.height && (this.resolution = new b(t.width, t.height)), this.parameters = { ...t }, this.parameters.width = this.resolution.width, this.parameters.height = this.resolution.height;
1581
+ if (t.width && t.height) {
1582
+ this.resolution = new y(t.width, t.height);
1583
+ const i = this.container.clientWidth, s = this.container.clientHeight;
1584
+ this.canvas2D.resize(i, s, this.getCanvas2DPixelRatio(i, s));
1585
+ }
1586
+ this.parameters = { ...t }, this.parameters.width = this.resolution.width, this.parameters.height = this.resolution.height;
1581
1587
  let e = Promise.resolve();
1582
1588
  return e = e.then(() => this.loadWidget(!1, !0)), e.catch((i) => {
1583
1589
  this.onLoadError(i);
@@ -1664,6 +1670,16 @@ class at {
1664
1670
  this.widget.hide(), this.widget = i, this.widget.show(), this.widgetVideo.hide(), this.onHotspotsChange();
1665
1671
  });
1666
1672
  }
1673
+ get aspectRatioOverride() {
1674
+ switch (this.options.aspectRatio) {
1675
+ case "4:3":
1676
+ return 4 / 3;
1677
+ case "16:9":
1678
+ return 16 / 9;
1679
+ default:
1680
+ return;
1681
+ }
1682
+ }
1667
1683
  get viewWidget() {
1668
1684
  switch (this.view?.mode) {
1669
1685
  case "image":
@@ -1678,12 +1694,6 @@ class at {
1678
1694
  return this.widgetImage;
1679
1695
  }
1680
1696
  }
1681
- checkResize() {
1682
- if (this.isDestroyed)
1683
- return;
1684
- const t = this.container.clientWidth, e = this.container.clientHeight;
1685
- (t !== this.containerWidth || e !== this.containerHeight) && (this.containerWidth = t, this.containerHeight = e, this.onResize()), this.isDestroyed || requestAnimationFrame(this.checkResize);
1686
- }
1687
1697
  onMouseDown(t) {
1688
1698
  this.widget.onMouseDown(t);
1689
1699
  }
@@ -1708,9 +1718,14 @@ class at {
1708
1718
  onDeviceOrientation(t) {
1709
1719
  this.widget.onDeviceOrientation(t);
1710
1720
  }
1721
+ // Cap per-axis so the canvas backing never exceeds the source resolution; otherwise
1722
+ // drawImage upscales the JPEG and looks blurry on iOS / MacOS.
1723
+ getCanvas2DPixelRatio(t, e) {
1724
+ return t <= 0 || e <= 0 || this.resolution.width <= 0 || this.resolution.height <= 0 ? window.devicePixelRatio : Math.min(window.devicePixelRatio, this.resolution.width / t, this.resolution.height / e);
1725
+ }
1711
1726
  onResize() {
1712
1727
  const t = this.container.clientWidth, e = this.container.clientHeight;
1713
- this.options.autores && (this.resolution = p.getStandardResolution(t * window.devicePixelRatio, e * window.devicePixelRatio), this.parameters.width = this.resolution.width, this.parameters.height = this.resolution.height), this.canvas2D.resize(t, e, window.devicePixelRatio), this.canvas3D.resize(t, e, window.devicePixelRatio), this.video.resize(t, e, this.resolution, this.options.fit), this.loadWidget(!1, !1).then(() => {
1728
+ this.options.autores && (this.resolution = b.getStandardResolution(t * window.devicePixelRatio, e * window.devicePixelRatio, this.aspectRatioOverride), this.parameters.width = this.resolution.width, this.parameters.height = this.resolution.height), this.canvas2D.resize(t, e, this.getCanvas2DPixelRatio(t, e)), this.canvas3D.resize(t, e, window.devicePixelRatio), this.video.resize(t, e, this.resolution, this.options.fit), this.loadWidget(!1, !1).then(() => {
1714
1729
  this.onHotspotsChange();
1715
1730
  }).catch((i) => {
1716
1731
  this.onLoadError(i);
@@ -1739,7 +1754,7 @@ class at {
1739
1754
  this.container.classList.remove("ls-viewer-container-loading"), this.options.events.onLoadError(...t);
1740
1755
  }
1741
1756
  }
1742
- var j;
1757
+ var q;
1743
1758
  ((v) => {
1744
1759
  ((t) => {
1745
1760
  t.Visible = "Visible", t.Occluded = "Occluded", t.Clipped = "Clipped", t.OutOfFrustum = "OutOfFrustum";
@@ -1752,12 +1767,12 @@ var j;
1752
1767
  })(v.SunUseCaseMode || (v.SunUseCaseMode = {})), ((t) => {
1753
1768
  t.ShowOnly = "showOnly", t.HideOnly = "hideOnly";
1754
1769
  })(v.SurfacesFilterMode || (v.SurfacesFilterMode = {}));
1755
- })(j || (j = {}));
1770
+ })(q || (q = {}));
1756
1771
  export {
1757
- at as Viewer,
1758
- j as WRAPIv2,
1772
+ nt as Viewer,
1773
+ q as WRAPIv2,
1759
1774
  J as WidgetImage,
1760
- K as WidgetVRCube,
1775
+ tt as WidgetVRCube,
1761
1776
  k as WidgetVRObject,
1762
- et as WidgetVideo
1777
+ it as WidgetVideo
1763
1778
  };