viral-viewer-2 6.4.7 → 6.4.9

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.
@@ -1,4 +1,4 @@
1
- import { Vector3 } from "three";
1
+ import { Object3D, Vector3 } from "three";
2
2
  import { ViralViewerApi } from "../..";
3
3
  export declare class ViralAvatar {
4
4
  private viralViewerApi;
@@ -6,7 +6,7 @@ export declare class ViralAvatar {
6
6
  private mixer;
7
7
  private idleAnimation;
8
8
  private walkAnimation;
9
- private avatar;
9
+ avatar: Object3D | null;
10
10
  private destination;
11
11
  isReady: boolean;
12
12
  name: string;
@@ -19,6 +19,7 @@ export declare class ViralAvatar {
19
19
  idle(): void;
20
20
  walk(): void;
21
21
  talk(content: string): void;
22
+ teleport(point: Vector3): void;
22
23
  render(delta: number): void;
23
24
  updateDestination(point: Vector3): void;
24
25
  dispose(): void;
@@ -10,6 +10,7 @@ export declare class ViralMouse {
10
10
  private mouseUpLeftQueuedEvents;
11
11
  private mouseDownRightQueuedEvents;
12
12
  private mouseUpRightQueuedEvents;
13
+ private mouseDoubleClickQueuedEvents;
13
14
  constructor(viralViewerApi: ViralViewerApi);
14
15
  private setupMousePositionUpdate;
15
16
  /**
@@ -28,4 +29,6 @@ export declare class ViralMouse {
28
29
  private handleClick;
29
30
  private setupMouseUp;
30
31
  private handleMouseUp;
32
+ private setupMouseDoubleClick;
33
+ private handleMouseDoubleClick;
31
34
  }
package/dist/index.mjs CHANGED
@@ -23,7 +23,7 @@ class na {
23
23
  this.X = 0, this.Y = 0, this.Z = 0;
24
24
  }
25
25
  }
26
- var Mn = /* @__PURE__ */ ((n) => (n[n.ON_MOUSE_MOVE = 0] = "ON_MOUSE_MOVE", n[n.ON_MOUSE_DOWN_LEFT = 1] = "ON_MOUSE_DOWN_LEFT", n[n.ON_MOUSE_UP_LEFT = 2] = "ON_MOUSE_UP_LEFT", n[n.ON_MOUSE_DOWN_RIGHT = 3] = "ON_MOUSE_DOWN_RIGHT", n[n.ON_MOUSE_UP_RIGHT = 4] = "ON_MOUSE_UP_RIGHT", n))(Mn || {}), oa = /* @__PURE__ */ ((n) => (n[n.ON_WAKE = 0] = "ON_WAKE", n[n.ON_SLEEP = 1] = "ON_SLEEP", n))(oa || {}), _o = /* @__PURE__ */ ((n) => (n[n.KEYDOWN = 0] = "KEYDOWN", n[n.KEYUP = 1] = "KEYUP", n))(_o || {}), Pi = /* @__PURE__ */ ((n) => (n[n.LOADED_SCENE = 0] = "LOADED_SCENE", n[n.LOADED_MATERIAL_MANAGER = 1] = "LOADED_MATERIAL_MANAGER", n[n.LOADED_RENDERER = 2] = "LOADED_RENDERER", n[n.LOADED_CAMERA = 3] = "LOADED_CAMERA", n[n.LOADED_CUBE = 4] = "LOADED_CUBE", n[n.LOADED_TOOLS = 5] = "LOADED_TOOLS", n))(Pi || {});
26
+ var vn = /* @__PURE__ */ ((n) => (n[n.ON_MOUSE_MOVE = 0] = "ON_MOUSE_MOVE", n[n.ON_MOUSE_DOWN_LEFT = 1] = "ON_MOUSE_DOWN_LEFT", n[n.ON_MOUSE_UP_LEFT = 2] = "ON_MOUSE_UP_LEFT", n[n.ON_MOUSE_DOWN_RIGHT = 3] = "ON_MOUSE_DOWN_RIGHT", n[n.ON_MOUSE_UP_RIGHT = 4] = "ON_MOUSE_UP_RIGHT", n[n.ON_MOUSE_DOUBLE_CLICK = 5] = "ON_MOUSE_DOUBLE_CLICK", n))(vn || {}), oa = /* @__PURE__ */ ((n) => (n[n.ON_WAKE = 0] = "ON_WAKE", n[n.ON_SLEEP = 1] = "ON_SLEEP", n))(oa || {}), _o = /* @__PURE__ */ ((n) => (n[n.KEYDOWN = 0] = "KEYDOWN", n[n.KEYUP = 1] = "KEYUP", n))(_o || {}), Pi = /* @__PURE__ */ ((n) => (n[n.LOADED_SCENE = 0] = "LOADED_SCENE", n[n.LOADED_MATERIAL_MANAGER = 1] = "LOADED_MATERIAL_MANAGER", n[n.LOADED_RENDERER = 2] = "LOADED_RENDERER", n[n.LOADED_CAMERA = 3] = "LOADED_CAMERA", n[n.LOADED_CUBE = 4] = "LOADED_CUBE", n[n.LOADED_TOOLS = 5] = "LOADED_TOOLS", n))(Pi || {});
27
27
  class Pl {
28
28
  constructor() {
29
29
  this.items = {};
@@ -4234,7 +4234,7 @@ class K1 extends Fr {
4234
4234
  this.dispatchEvent({ type: "dispose" });
4235
4235
  }
4236
4236
  }
4237
- class bn extends K1 {
4237
+ class wn extends K1 {
4238
4238
  constructor(e = 1, t = 1, i = {}) {
4239
4239
  super(e, t, i), this.isWebGLRenderTarget = !0;
4240
4240
  }
@@ -4249,7 +4249,7 @@ class $1 extends Oi {
4249
4249
  super(null), this.isData3DTexture = !0, this.image = { data: e, width: t, height: i, depth: s }, this.magFilter = mi, this.minFilter = mi, this.wrapR = Hn, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
4250
4250
  }
4251
4251
  }
4252
- class J1 extends bn {
4252
+ class J1 extends wn {
4253
4253
  constructor(e = 1, t = 1, i = 1, s = {}) {
4254
4254
  super(e, t, s), this.isWebGLMultipleRenderTargets = !0;
4255
4255
  const r = this.texture;
@@ -7108,7 +7108,7 @@ function Oo(n) {
7108
7108
  }
7109
7109
  return e;
7110
7110
  }
7111
- function _n(n) {
7111
+ function Mn(n) {
7112
7112
  const e = {};
7113
7113
  for (let t = 0; t < n.length; t++) {
7114
7114
  const i = Oo(n[t]);
@@ -7126,7 +7126,7 @@ function d_(n) {
7126
7126
  function sx(n) {
7127
7127
  return n.getRenderTarget() === null ? n.outputColorSpace : ui.workingColorSpace;
7128
7128
  }
7129
- const Ul = { clone: Oo, merge: _n };
7129
+ const Ul = { clone: Oo, merge: Mn };
7130
7130
  var f_ = `void main() {
7131
7131
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
7132
7132
  }`, p_ = `void main() {
@@ -7381,7 +7381,7 @@ class qf extends Oi {
7381
7381
  this.image = e;
7382
7382
  }
7383
7383
  }
7384
- class g_ extends bn {
7384
+ class g_ extends wn {
7385
7385
  constructor(e = 1, t = {}) {
7386
7386
  super(e, e, t), this.isWebGLCubeRenderTarget = !0;
7387
7387
  const i = { width: e, height: e, depth: 1 }, s = [i, i, i, i, i, i];
@@ -11514,7 +11514,7 @@ void main() {
11514
11514
  }
11515
11515
  }, ys = {
11516
11516
  basic: {
11517
- uniforms: /* @__PURE__ */ _n([
11517
+ uniforms: /* @__PURE__ */ Mn([
11518
11518
  tt.common,
11519
11519
  tt.specularmap,
11520
11520
  tt.envmap,
@@ -11526,7 +11526,7 @@ void main() {
11526
11526
  fragmentShader: Wt.meshbasic_frag
11527
11527
  },
11528
11528
  lambert: {
11529
- uniforms: /* @__PURE__ */ _n([
11529
+ uniforms: /* @__PURE__ */ Mn([
11530
11530
  tt.common,
11531
11531
  tt.specularmap,
11532
11532
  tt.envmap,
@@ -11546,7 +11546,7 @@ void main() {
11546
11546
  fragmentShader: Wt.meshlambert_frag
11547
11547
  },
11548
11548
  phong: {
11549
- uniforms: /* @__PURE__ */ _n([
11549
+ uniforms: /* @__PURE__ */ Mn([
11550
11550
  tt.common,
11551
11551
  tt.specularmap,
11552
11552
  tt.envmap,
@@ -11568,7 +11568,7 @@ void main() {
11568
11568
  fragmentShader: Wt.meshphong_frag
11569
11569
  },
11570
11570
  standard: {
11571
- uniforms: /* @__PURE__ */ _n([
11571
+ uniforms: /* @__PURE__ */ Mn([
11572
11572
  tt.common,
11573
11573
  tt.envmap,
11574
11574
  tt.aomap,
@@ -11593,7 +11593,7 @@ void main() {
11593
11593
  fragmentShader: Wt.meshphysical_frag
11594
11594
  },
11595
11595
  toon: {
11596
- uniforms: /* @__PURE__ */ _n([
11596
+ uniforms: /* @__PURE__ */ Mn([
11597
11597
  tt.common,
11598
11598
  tt.aomap,
11599
11599
  tt.lightmap,
@@ -11612,7 +11612,7 @@ void main() {
11612
11612
  fragmentShader: Wt.meshtoon_frag
11613
11613
  },
11614
11614
  matcap: {
11615
- uniforms: /* @__PURE__ */ _n([
11615
+ uniforms: /* @__PURE__ */ Mn([
11616
11616
  tt.common,
11617
11617
  tt.bumpmap,
11618
11618
  tt.normalmap,
@@ -11626,7 +11626,7 @@ void main() {
11626
11626
  fragmentShader: Wt.meshmatcap_frag
11627
11627
  },
11628
11628
  points: {
11629
- uniforms: /* @__PURE__ */ _n([
11629
+ uniforms: /* @__PURE__ */ Mn([
11630
11630
  tt.points,
11631
11631
  tt.fog
11632
11632
  ]),
@@ -11634,7 +11634,7 @@ void main() {
11634
11634
  fragmentShader: Wt.points_frag
11635
11635
  },
11636
11636
  dashed: {
11637
- uniforms: /* @__PURE__ */ _n([
11637
+ uniforms: /* @__PURE__ */ Mn([
11638
11638
  tt.common,
11639
11639
  tt.fog,
11640
11640
  {
@@ -11647,7 +11647,7 @@ void main() {
11647
11647
  fragmentShader: Wt.linedashed_frag
11648
11648
  },
11649
11649
  depth: {
11650
- uniforms: /* @__PURE__ */ _n([
11650
+ uniforms: /* @__PURE__ */ Mn([
11651
11651
  tt.common,
11652
11652
  tt.displacementmap
11653
11653
  ]),
@@ -11655,7 +11655,7 @@ void main() {
11655
11655
  fragmentShader: Wt.depth_frag
11656
11656
  },
11657
11657
  normal: {
11658
- uniforms: /* @__PURE__ */ _n([
11658
+ uniforms: /* @__PURE__ */ Mn([
11659
11659
  tt.common,
11660
11660
  tt.bumpmap,
11661
11661
  tt.normalmap,
@@ -11668,7 +11668,7 @@ void main() {
11668
11668
  fragmentShader: Wt.meshnormal_frag
11669
11669
  },
11670
11670
  sprite: {
11671
- uniforms: /* @__PURE__ */ _n([
11671
+ uniforms: /* @__PURE__ */ Mn([
11672
11672
  tt.sprite,
11673
11673
  tt.fog
11674
11674
  ]),
@@ -11711,7 +11711,7 @@ void main() {
11711
11711
  fragmentShader: Wt.equirect_frag
11712
11712
  },
11713
11713
  distanceRGBA: {
11714
- uniforms: /* @__PURE__ */ _n([
11714
+ uniforms: /* @__PURE__ */ Mn([
11715
11715
  tt.common,
11716
11716
  tt.displacementmap,
11717
11717
  {
@@ -11724,7 +11724,7 @@ void main() {
11724
11724
  fragmentShader: Wt.distanceRGBA_frag
11725
11725
  },
11726
11726
  shadow: {
11727
- uniforms: /* @__PURE__ */ _n([
11727
+ uniforms: /* @__PURE__ */ Mn([
11728
11728
  tt.lights,
11729
11729
  tt.fog,
11730
11730
  {
@@ -11737,7 +11737,7 @@ void main() {
11737
11737
  }
11738
11738
  };
11739
11739
  ys.physical = {
11740
- uniforms: /* @__PURE__ */ _n([
11740
+ uniforms: /* @__PURE__ */ Mn([
11741
11741
  ys.standard.uniforms,
11742
11742
  {
11743
11743
  clearcoat: { value: 0 },
@@ -12511,7 +12511,7 @@ function rA(n) {
12511
12511
  return { lodPlanes: e, sizeLods: t, sigmas: i };
12512
12512
  }
12513
12513
  function bg(n, e, t) {
12514
- const i = new bn(n, e, t);
12514
+ const i = new wn(n, e, t);
12515
12515
  return i.texture.mapping = lc, i.texture.name = "PMREM.cubeUv", i.scissorTest = !0, i;
12516
12516
  }
12517
12517
  function jc(n, e, t, i, s) {
@@ -14822,7 +14822,7 @@ function VT(n, e, t) {
14822
14822
  const ge = me.getFrameExtents();
14823
14823
  if (s.multiply(ge), r.copy(me.mapSize), (s.x > f || s.y > f) && (s.x > f && (r.x = Math.floor(f / ge.x), s.x = r.x * ge.x, me.mapSize.x = r.x), s.y > f && (r.y = Math.floor(f / ge.y), s.y = r.y * ge.y, me.mapSize.y = r.y)), me.map === null || he === !0 || J === !0) {
14824
14824
  const De = this.type !== Zs ? { minFilter: mi, magFilter: mi } : {};
14825
- me.map !== null && me.map.dispose(), me.map = new bn(s.x, s.y, De), me.map.texture.name = xe.name + ".shadowMap", me.camera.updateProjectionMatrix();
14825
+ me.map !== null && me.map.dispose(), me.map = new wn(s.x, s.y, De), me.map.texture.name = xe.name + ".shadowMap", me.camera.updateProjectionMatrix();
14826
14826
  }
14827
14827
  n.setRenderTarget(me.map), n.clear();
14828
14828
  const Ie = me.getViewportCount();
@@ -14841,7 +14841,7 @@ function VT(n, e, t) {
14841
14841
  };
14842
14842
  function C(z, F) {
14843
14843
  const Q = e.update(E);
14844
- g.defines.VSM_SAMPLES !== z.blurSamples && (g.defines.VSM_SAMPLES = z.blurSamples, x.defines.VSM_SAMPLES = z.blurSamples, g.needsUpdate = !0, x.needsUpdate = !0), z.mapPass === null && (z.mapPass = new bn(s.x, s.y)), g.uniforms.shadow_pass.value = z.map.texture, g.uniforms.resolution.value = z.mapSize, g.uniforms.radius.value = z.radius, n.setRenderTarget(z.mapPass), n.clear(), n.renderBufferDirect(F, null, Q, g, E, null), x.uniforms.shadow_pass.value = z.mapPass.texture, x.uniforms.resolution.value = z.mapSize, x.uniforms.radius.value = z.radius, n.setRenderTarget(z.map), n.clear(), n.renderBufferDirect(F, null, Q, x, E, null);
14844
+ g.defines.VSM_SAMPLES !== z.blurSamples && (g.defines.VSM_SAMPLES = z.blurSamples, x.defines.VSM_SAMPLES = z.blurSamples, g.needsUpdate = !0, x.needsUpdate = !0), z.mapPass === null && (z.mapPass = new wn(s.x, s.y)), g.uniforms.shadow_pass.value = z.map.texture, g.uniforms.resolution.value = z.mapSize, g.uniforms.radius.value = z.radius, n.setRenderTarget(z.mapPass), n.clear(), n.renderBufferDirect(F, null, Q, g, E, null), x.uniforms.shadow_pass.value = z.mapPass.texture, x.uniforms.resolution.value = z.mapSize, x.uniforms.radius.value = z.radius, n.setRenderTarget(z.map), n.clear(), n.renderBufferDirect(F, null, Q, x, E, null);
14845
14845
  }
14846
14846
  function T(z, F, Q, $) {
14847
14847
  let O = null;
@@ -16133,7 +16133,7 @@ class KT extends Fr {
16133
16133
  stencil: b.stencil,
16134
16134
  framebufferScaleFactor: r
16135
16135
  };
16136
- x = new XRWebGLLayer(s, t, we), s.updateRenderState({ baseLayer: x }), e.setPixelRatio(1), e.setSize(x.framebufferWidth, x.framebufferHeight, !1), C = new bn(
16136
+ x = new XRWebGLLayer(s, t, we), s.updateRenderState({ baseLayer: x }), e.setPixelRatio(1), e.setSize(x.framebufferWidth, x.framebufferHeight, !1), C = new wn(
16137
16137
  x.framebufferWidth,
16138
16138
  x.framebufferHeight,
16139
16139
  {
@@ -16151,7 +16151,7 @@ class KT extends Fr {
16151
16151
  depthFormat: We,
16152
16152
  scaleFactor: r
16153
16153
  };
16154
- p = new XRWebGLBinding(s, t), g = p.createProjectionLayer(at), s.updateRenderState({ layers: [g] }), e.setPixelRatio(1), e.setSize(g.textureWidth, g.textureHeight, !1), C = new bn(
16154
+ p = new XRWebGLBinding(s, t), g = p.createProjectionLayer(at), s.updateRenderState({ layers: [g] }), e.setPixelRatio(1), e.setSize(g.textureWidth, g.textureHeight, !1), C = new wn(
16155
16155
  g.textureWidth,
16156
16156
  g.textureHeight,
16157
16157
  {
@@ -16761,7 +16761,7 @@ class Kf {
16761
16761
  if ((re.isScene === !0 ? re.overrideMaterial : null) !== null)
16762
16762
  return;
16763
16763
  const Pe = He.isWebGL2;
16764
- qe === null && (qe = new bn(1, 1, {
16764
+ qe === null && (qe = new wn(1, 1, {
16765
16765
  generateMipmaps: !0,
16766
16766
  type: Me.has("EXT_color_buffer_half_float") ? rr : Ir,
16767
16767
  minFilter: bs,
@@ -17077,7 +17077,7 @@ class ep {
17077
17077
  };
17078
17078
  }
17079
17079
  }
17080
- const wn = /* @__PURE__ */ new G();
17080
+ const _n = /* @__PURE__ */ new G();
17081
17081
  class _a {
17082
17082
  constructor(e, t, i, s = !1) {
17083
17083
  this.isInterleavedBufferAttribute = !0, this.name = "", this.data = e, this.itemSize = t, this.offset = i, this.normalized = s;
@@ -17093,17 +17093,17 @@ class _a {
17093
17093
  }
17094
17094
  applyMatrix4(e) {
17095
17095
  for (let t = 0, i = this.data.count; t < i; t++)
17096
- wn.fromBufferAttribute(this, t), wn.applyMatrix4(e), this.setXYZ(t, wn.x, wn.y, wn.z);
17096
+ _n.fromBufferAttribute(this, t), _n.applyMatrix4(e), this.setXYZ(t, _n.x, _n.y, _n.z);
17097
17097
  return this;
17098
17098
  }
17099
17099
  applyNormalMatrix(e) {
17100
17100
  for (let t = 0, i = this.count; t < i; t++)
17101
- wn.fromBufferAttribute(this, t), wn.applyNormalMatrix(e), this.setXYZ(t, wn.x, wn.y, wn.z);
17101
+ _n.fromBufferAttribute(this, t), _n.applyNormalMatrix(e), this.setXYZ(t, _n.x, _n.y, _n.z);
17102
17102
  return this;
17103
17103
  }
17104
17104
  transformDirection(e) {
17105
17105
  for (let t = 0, i = this.count; t < i; t++)
17106
- wn.fromBufferAttribute(this, t), wn.transformDirection(e), this.setXYZ(t, wn.x, wn.y, wn.z);
17106
+ _n.fromBufferAttribute(this, t), _n.transformDirection(e), this.setXYZ(t, _n.x, _n.y, _n.z);
17107
17107
  return this;
17108
17108
  }
17109
17109
  getComponent(e, t) {
@@ -23342,7 +23342,7 @@ class O2 {
23342
23342
  }
23343
23343
  class N2 {
23344
23344
  constructor(e) {
23345
- this.viralViewerApi = e, this.position = new Se(), this.rawPosition = new Se(), this.mouseMoveQueuedEvents = [], this.mouseDownLeftQueuedEvents = [], this.mouseUpLeftQueuedEvents = [], this.mouseDownRightQueuedEvents = [], this.mouseUpRightQueuedEvents = [], this.hoverMeshes = [], this.handleClick = async (t) => {
23345
+ this.viralViewerApi = e, this.position = new Se(), this.rawPosition = new Se(), this.mouseMoveQueuedEvents = [], this.mouseDownLeftQueuedEvents = [], this.mouseUpLeftQueuedEvents = [], this.mouseDownRightQueuedEvents = [], this.mouseUpRightQueuedEvents = [], this.mouseDoubleClickQueuedEvents = [], this.hoverMeshes = [], this.handleClick = async (t) => {
23346
23346
  var i, s;
23347
23347
  if (this.viralViewerApi) {
23348
23348
  if (t.button == 0) {
@@ -23383,9 +23383,14 @@ class N2 {
23383
23383
  r(t);
23384
23384
  });
23385
23385
  }
23386
+ }, this.handleMouseDoubleClick = async (t) => {
23387
+ this.mouseDoubleClickQueuedEvents.length > 0 && this.mouseDoubleClickQueuedEvents.forEach((i) => {
23388
+ const [s, r] = i;
23389
+ r(t);
23390
+ });
23386
23391
  }, this.setupMousePositionUpdate(
23387
23392
  this.viralViewerApi.viralRenderer.renderer.domElement
23388
- ), this.setupMouseDown(this.viralViewerApi.viralRenderer.renderer.domElement), this.setupMouseUp(this.viralViewerApi.viralRenderer.renderer.domElement);
23393
+ ), this.setupMouseDown(this.viralViewerApi.viralRenderer.renderer.domElement), this.setupMouseUp(this.viralViewerApi.viralRenderer.renderer.domElement), this.setupMouseDoubleClick(this.viralViewerApi.viralRenderer.renderer.domElement);
23389
23394
  }
23390
23395
  setupMousePositionUpdate(e) {
23391
23396
  e.onmousemove = (t) => {
@@ -23410,32 +23415,35 @@ class N2 {
23410
23415
  */
23411
23416
  addEventListener(e, t, i) {
23412
23417
  switch (e) {
23413
- case Mn.ON_MOUSE_MOVE:
23418
+ case vn.ON_MOUSE_MOVE:
23414
23419
  this.mouseMoveQueuedEvents.push([t, i]);
23415
23420
  break;
23416
- case Mn.ON_MOUSE_DOWN_LEFT:
23421
+ case vn.ON_MOUSE_DOWN_LEFT:
23417
23422
  this.mouseDownLeftQueuedEvents.push([t, i]);
23418
23423
  break;
23419
- case Mn.ON_MOUSE_UP_LEFT:
23424
+ case vn.ON_MOUSE_UP_LEFT:
23420
23425
  this.mouseUpLeftQueuedEvents.push([t, i]);
23421
23426
  break;
23422
- case Mn.ON_MOUSE_DOWN_RIGHT:
23427
+ case vn.ON_MOUSE_DOWN_RIGHT:
23423
23428
  this.mouseDownRightQueuedEvents.push([t, i]);
23424
23429
  break;
23425
- case Mn.ON_MOUSE_UP_RIGHT:
23430
+ case vn.ON_MOUSE_UP_RIGHT:
23426
23431
  this.mouseUpRightQueuedEvents.push([t, i]);
23427
23432
  break;
23433
+ case vn.ON_MOUSE_DOUBLE_CLICK:
23434
+ this.mouseDoubleClickQueuedEvents.push([t, i]);
23435
+ break;
23428
23436
  }
23429
23437
  }
23430
23438
  removeEventListener(e, t) {
23431
23439
  switch (e) {
23432
- case Mn.ON_MOUSE_MOVE:
23440
+ case vn.ON_MOUSE_MOVE:
23433
23441
  {
23434
23442
  let i = this.mouseMoveQueuedEvents.findIndex((s) => s[0] == t);
23435
23443
  this.mouseMoveQueuedEvents.splice(i, 1);
23436
23444
  }
23437
23445
  break;
23438
- case Mn.ON_MOUSE_DOWN_LEFT:
23446
+ case vn.ON_MOUSE_DOWN_LEFT:
23439
23447
  {
23440
23448
  let i = this.mouseDownLeftQueuedEvents.findIndex(
23441
23449
  (s) => s[0] == t
@@ -23443,7 +23451,7 @@ class N2 {
23443
23451
  this.mouseDownLeftQueuedEvents.splice(i, 1);
23444
23452
  }
23445
23453
  break;
23446
- case Mn.ON_MOUSE_UP_LEFT:
23454
+ case vn.ON_MOUSE_UP_LEFT:
23447
23455
  {
23448
23456
  let i = this.mouseUpLeftQueuedEvents.findIndex(
23449
23457
  (s) => s[0] == t
@@ -23451,7 +23459,7 @@ class N2 {
23451
23459
  this.mouseUpLeftQueuedEvents.splice(i, 1);
23452
23460
  }
23453
23461
  break;
23454
- case Mn.ON_MOUSE_DOWN_RIGHT:
23462
+ case vn.ON_MOUSE_DOWN_RIGHT:
23455
23463
  {
23456
23464
  let i = this.mouseDownRightQueuedEvents.findIndex(
23457
23465
  (s) => s[0] == t
@@ -23459,7 +23467,7 @@ class N2 {
23459
23467
  this.mouseDownRightQueuedEvents.splice(i, 1);
23460
23468
  }
23461
23469
  break;
23462
- case Mn.ON_MOUSE_UP_RIGHT:
23470
+ case vn.ON_MOUSE_UP_RIGHT:
23463
23471
  {
23464
23472
  let i = this.mouseUpRightQueuedEvents.findIndex(
23465
23473
  (s) => s[0] == t
@@ -23505,6 +23513,11 @@ class N2 {
23505
23513
  e.onmouseup = this.handleMouseUp;
23506
23514
  }
23507
23515
  //#endregion
23516
+ //#region Double click
23517
+ setupMouseDoubleClick(e) {
23518
+ e.ondblclick = this.handleMouseDoubleClick;
23519
+ }
23520
+ //#endregion
23508
23521
  }
23509
23522
  const Jr = new fc(), xn = new G(), gr = new G(), Ii = new Ui(), v0 = {
23510
23523
  X: new G(1, 0, 0),
@@ -24009,7 +24022,7 @@ class G2 {
24009
24022
  }
24010
24023
  addPivotPoint() {
24011
24024
  const e = new hc(1, 32, 32), t = new Ln({
24012
- color: vn.hexToThreejsColor(kt.primary),
24025
+ color: bn.hexToThreejsColor(kt.primary),
24013
24026
  transparent: !0,
24014
24027
  opacity: 0.5
24015
24028
  }), i = new fe(e, t);
@@ -24260,7 +24273,7 @@ var Nx = class Bx {
24260
24273
  dispose() {
24261
24274
  for (const e of Object.keys(this)) {
24262
24275
  const t = this[e];
24263
- (t instanceof bn || t instanceof $i || t instanceof Oi || t instanceof Bx) && this[e].dispose();
24276
+ (t instanceof wn || t instanceof $i || t instanceof Oi || t instanceof Bx) && this[e].dispose();
24264
24277
  }
24265
24278
  }
24266
24279
  }, T0 = /* @__PURE__ */ new ut(), K2 = class extends Nx {
@@ -25656,14 +25669,14 @@ class rP extends pc {
25656
25669
  const h = r[a];
25657
25670
  return r[a] = l, a === "aoSamples" && h !== l && this.configureAOPass(this.configuration.logarithmicDepthBuffer), a === "denoiseSamples" && h !== l && this.configureDenoisePass(this.configuration.logarithmicDepthBuffer), a === "halfRes" && h !== l && (this.configureAOPass(this.configuration.logarithmicDepthBuffer), this.configureHalfResTargets(), this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer), this.setSize(this.width, this.height)), a === "depthAwareUpsampling" && h !== l && this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer), !0;
25658
25671
  }
25659
- }), this.samples = [], this.samplesR = [], this.samplesDenoise = [], this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer), this.configureSampleDependentPasses(), this.configureHalfResTargets(), this.beautyRenderTarget = new bn(this.width, this.height, {
25672
+ }), this.samples = [], this.samplesR = [], this.samplesDenoise = [], this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer), this.configureSampleDependentPasses(), this.configureHalfResTargets(), this.beautyRenderTarget = new wn(this.width, this.height, {
25660
25673
  minFilter: Di,
25661
25674
  magFilter: mi
25662
- }), this.beautyRenderTarget.depthTexture = new jf(this.width, this.height, er), this.beautyRenderTarget.depthTexture.format = Dr, this.writeTargetInternal = new bn(this.width, this.height, {
25675
+ }), this.beautyRenderTarget.depthTexture = new jf(this.width, this.height, er), this.beautyRenderTarget.depthTexture.format = Dr, this.writeTargetInternal = new wn(this.width, this.height, {
25663
25676
  minFilter: Di,
25664
25677
  magFilter: Di,
25665
25678
  depthBuffer: !1
25666
- }), this.readTargetInternal = new bn(this.width, this.height, {
25679
+ }), this.readTargetInternal = new wn(this.width, this.height, {
25667
25680
  minFilter: Di,
25668
25681
  magFilter: Di,
25669
25682
  depthBuffer: !1
@@ -25875,7 +25888,7 @@ class lP {
25875
25888
  constructor(e, t) {
25876
25889
  if (this.renderer = e, this._pixelRatio = e.getPixelRatio(), t === void 0) {
25877
25890
  const i = e.getSize(new Se());
25878
- this._width = i.width, this._height = i.height, t = new bn(this._width * this._pixelRatio, this._height * this._pixelRatio, { type: rr }), t.texture.name = "EffectComposer.rt1";
25891
+ this._width = i.width, this._height = i.height, t = new wn(this._width * this._pixelRatio, this._height * this._pixelRatio, { type: rr }), t.texture.name = "EffectComposer.rt1";
25879
25892
  } else
25880
25893
  this._width = t.width, this._height = t.height;
25881
25894
  this.renderTarget1 = t, this.renderTarget2 = t.clone(), this.renderTarget2.texture.name = "EffectComposer.rt2", this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2, this.renderToScreen = !0, this.passes = [], this.copyPass = new kx(aP), this.copyPass.material.blending = As, this.clock = new Ix();
@@ -26383,10 +26396,10 @@ const wh = {
26383
26396
  };
26384
26397
  class cP extends pc {
26385
26398
  constructor(e, t) {
26386
- super(), this.edgesRT = new bn(e, t, {
26399
+ super(), this.edgesRT = new wn(e, t, {
26387
26400
  depthBuffer: !1,
26388
26401
  type: rr
26389
- }), this.edgesRT.texture.name = "SMAAPass.edges", this.weightsRT = new bn(e, t, {
26402
+ }), this.edgesRT.texture.name = "SMAAPass.edges", this.weightsRT = new wn(e, t, {
26390
26403
  depthBuffer: !1,
26391
26404
  type: rr
26392
26405
  }), this.weightsRT.texture.name = "SMAAPass.weights";
@@ -26505,7 +26518,7 @@ class Sn {
26505
26518
  );
26506
26519
  }
26507
26520
  }
26508
- class vn {
26521
+ class bn {
26509
26522
  static middlePoint(e, t) {
26510
26523
  return new G(
26511
26524
  (e.x + t.x) / 2,
@@ -26801,7 +26814,7 @@ class yP {
26801
26814
  this.viralViewerApi.viralDraggableModal.show(), this.viralViewerApi.viralContextMenu.hideContextMenu();
26802
26815
  }
26803
26816
  )), this.viralViewerApi.viralMouse && (this.viralViewerApi.viralMouse.addEventListener(
26804
- Mn.ON_MOUSE_DOWN_RIGHT,
26817
+ vn.ON_MOUSE_DOWN_RIGHT,
26805
26818
  "ShowContextMenu",
26806
26819
  (e) => {
26807
26820
  this.viralViewerApi.viralContextMenu.showContextMenu(
@@ -26811,7 +26824,7 @@ class yP {
26811
26824
  );
26812
26825
  }
26813
26826
  ), this.viralViewerApi.viralMouse.addEventListener(
26814
- Mn.ON_MOUSE_DOWN_LEFT,
26827
+ vn.ON_MOUSE_DOWN_LEFT,
26815
26828
  "HideContextMenu",
26816
26829
  (e) => {
26817
26830
  this.viralViewerApi.viralContextMenu.hideContextMenu();
@@ -26877,7 +26890,7 @@ class yP {
26877
26890
  }
26878
26891
  );
26879
26892
  this.viralViewerApi.viralMouse.addEventListener(
26880
- Mn.ON_MOUSE_MOVE,
26893
+ vn.ON_MOUSE_MOVE,
26881
26894
  "HoverElement",
26882
26895
  (t) => {
26883
26896
  this._hoverElementEnable && e.handleEvent(t);
@@ -26889,7 +26902,7 @@ class yP {
26889
26902
  }
26890
26903
  selectElementHandler() {
26891
26904
  this.viralViewerApi.viralMouse.addEventListener(
26892
- Mn.ON_MOUSE_DOWN_LEFT,
26905
+ vn.ON_MOUSE_DOWN_LEFT,
26893
26906
  "SelectElement",
26894
26907
  (e) => {
26895
26908
  var i;
@@ -27870,7 +27883,7 @@ Kn.d = (n, e) => {
27870
27883
  var ni = {};
27871
27884
  (() => {
27872
27885
  Kn.d(ni, { HY: () => u, K8: () => i, vF: () => b, jM: () => v, st: () => C, J7: () => yt, KV: () => at, Tl: () => We, gv: () => ae, LR: () => _e, C9: () => Ae, zF: () => je, XL: () => st, uv: () => q, vs: () => V, YJ: () => Ne, i9: () => h, uD: () => l, lV: () => r, Sp: () => s, RJ: () => Pn, SB: () => Cs, TL: () => T, oe: () => S, AB: () => a, dZ: () => B, Gf: () => Je, gK: () => z, BT: () => $, bt: () => F, sX: () => Q });
27873
- const n = (e = { AdditiveBlending: () => af, Box3: () => di, BufferAttribute: () => Zt, BufferGeometry: () => Xt, CanvasTexture: () => yf, Color: () => ut, DataTexture: () => ma, EventDispatcher: () => Fr, Frustum: () => cc, GLSL3: () => uf, LessEqualDepth: () => jl, LineBasicMaterial: () => ns, LineSegments: () => Ma, LinearFilter: () => Di, Matrix4: () => nt, NearestFilter: () => mi, NoBlending: () => As, Object3D: () => oi, Points: () => sp, RGBAFormat: () => An, RawShaderMaterial: () => Sx, Scene: () => wa, ShaderMaterial: () => Ci, Sphere: () => Qi, Texture: () => Oi, Uint8BufferAttribute: () => c_, Vector2: () => Se, Vector3: () => G, Vector4: () => ai, WebGLRenderTarget: () => bn }, t = {}, Kn.d(t, e), t);
27886
+ const n = (e = { AdditiveBlending: () => af, Box3: () => di, BufferAttribute: () => Zt, BufferGeometry: () => Xt, CanvasTexture: () => yf, Color: () => ut, DataTexture: () => ma, EventDispatcher: () => Fr, Frustum: () => cc, GLSL3: () => uf, LessEqualDepth: () => jl, LineBasicMaterial: () => ns, LineSegments: () => Ma, LinearFilter: () => Di, Matrix4: () => nt, NearestFilter: () => mi, NoBlending: () => As, Object3D: () => oi, Points: () => sp, RGBAFormat: () => An, RawShaderMaterial: () => Sx, Scene: () => wa, ShaderMaterial: () => Ci, Sphere: () => Qi, Texture: () => Oi, Uint8BufferAttribute: () => c_, Vector2: () => Se, Vector3: () => G, Vector4: () => ai, WebGLRenderTarget: () => wn }, t = {}, Kn.d(t, e), t);
27874
27887
  var e, t, i, s, r, a, l, h;
27875
27888
  class u extends n.ShaderMaterial {
27876
27889
  constructor() {
@@ -33504,7 +33517,7 @@ class PP {
33504
33517
  initial(e) {
33505
33518
  for (let t = 0; t < e.length; t++) {
33506
33519
  const i = e[t];
33507
- let s = vn.rgbToThreejsColor(
33520
+ let s = bn.rgbToThreejsColor(
33508
33521
  i.Red,
33509
33522
  i.Green,
33510
33523
  i.Blue
@@ -33696,7 +33709,7 @@ class IP {
33696
33709
  initial(e) {
33697
33710
  for (let t = 0; t < e.length; t++) {
33698
33711
  const i = e[t];
33699
- let s = vn.rgbToThreejsColor(
33712
+ let s = bn.rgbToThreejsColor(
33700
33713
  i.Red,
33701
33714
  i.Green,
33702
33715
  i.Blue
@@ -37647,7 +37660,7 @@ class zP {
37647
37660
  initial(e) {
37648
37661
  for (let t = 0; t < e.length; t++) {
37649
37662
  const i = e[t];
37650
- let s = vn.rgbToThreejsColor(
37663
+ let s = bn.rgbToThreejsColor(
37651
37664
  i.Red,
37652
37665
  i.Green,
37653
37666
  i.Blue
@@ -37750,7 +37763,7 @@ class UP {
37750
37763
  a.push(-E.X), a.push(E.Z), a.push(E.Y);
37751
37764
  }
37752
37765
  const l = new Float32Array(a);
37753
- let h = vn.rgbToThreejsColor(
37766
+ let h = bn.rgbToThreejsColor(
37754
37767
  s.Red,
37755
37768
  s.Green,
37756
37769
  s.Blue
@@ -37776,7 +37789,7 @@ class UP {
37776
37789
  l.push(-x.X), l.push(x.Z), l.push(x.Y);
37777
37790
  }
37778
37791
  const h = new Float32Array(l);
37779
- let u = vn.rgbToThreejsColor(
37792
+ let u = bn.rgbToThreejsColor(
37780
37793
  s.Red,
37781
37794
  s.Green,
37782
37795
  s.Blue
@@ -37917,7 +37930,7 @@ class UP {
37917
37930
  -g.CameraData.box.max.X,
37918
37931
  g.CameraData.box.max.Z,
37919
37932
  g.CameraData.box.max.Y
37920
- ), E = vn.middlePoint(x, w), b = Math.abs(
37933
+ ), E = bn.middlePoint(x, w), b = Math.abs(
37921
37934
  g.CameraData.box.max.X - g.CameraData.box.min.X
37922
37935
  ), v = Math.abs(
37923
37936
  g.CameraData.box.max.Y - g.CameraData.box.min.Y
@@ -41303,21 +41316,21 @@ class PR {
41303
41316
  class CR {
41304
41317
  constructor(e) {
41305
41318
  this.viralViewerApi = e, this.hoverMaterial = new Nr({
41306
- color: vn.hexToThreejsColor(kt.secondary),
41319
+ color: bn.hexToThreejsColor(kt.secondary),
41307
41320
  opacity: 0.7,
41308
41321
  transparent: !0,
41309
41322
  depthTest: !1,
41310
41323
  name: "Render Material",
41311
41324
  flatShading: !0
41312
41325
  }), this.selectedMaterial = new Nr({
41313
- color: vn.hexToThreejsColor(kt.secondary),
41326
+ color: bn.hexToThreejsColor(kt.secondary),
41314
41327
  opacity: 0.7,
41315
41328
  transparent: !0,
41316
41329
  name: "Render Material",
41317
41330
  depthTest: !1,
41318
41331
  flatShading: !0
41319
41332
  }), this.lineMaterial = new ns({
41320
- color: vn.hexToThreejsColor(kt.accent),
41333
+ color: bn.hexToThreejsColor(kt.accent),
41321
41334
  linewidth: 500
41322
41335
  // depthTest: false,
41323
41336
  }), this.vertexShader = `
@@ -41836,7 +41849,7 @@ class WR {
41836
41849
  let s = this.defaultSprite.clone();
41837
41850
  s.position.copy(this.point1), this.tempMeasure.add(s);
41838
41851
  } else if (this.point1 && !this.point2) {
41839
- this.point2 = i, vn.clearChildren(this.tempMeasure);
41852
+ this.point2 = i, bn.clearChildren(this.tempMeasure);
41840
41853
  let s = this.defaultSprite.clone();
41841
41854
  s.position.copy(this.point1), this.measureObject.add(s);
41842
41855
  let r = this.defaultSprite.clone();
@@ -41871,7 +41884,7 @@ class WR {
41871
41884
  }
41872
41885
  makeLine(e, t) {
41873
41886
  let i = new ns({
41874
- color: vn.hexToThreejsColor(kt.primary),
41887
+ color: bn.hexToThreejsColor(kt.primary),
41875
41888
  linewidth: 20
41876
41889
  });
41877
41890
  const s = [e, t], r = new Xt().setFromPoints(s);
@@ -41892,14 +41905,14 @@ class WR {
41892
41905
  sizeAttenuation: !1
41893
41906
  }));
41894
41907
  h.scale.set(2e-3 * s.width * 0.5, 25e-4 * s.height * 0.5, 1);
41895
- let u = vn.middlePoint(e, t);
41908
+ let u = bn.middlePoint(e, t);
41896
41909
  return h.position.copy(u), h;
41897
41910
  }
41898
41911
  dispose() {
41899
- this.resetPickedPoints(), vn.clearChildren(this.measureObject), vn.clearChildren(this.tempMeasure), this.viralTools.viralViewerApi.viralRenderer.render();
41912
+ this.resetPickedPoints(), bn.clearChildren(this.measureObject), bn.clearChildren(this.tempMeasure), this.viralTools.viralViewerApi.viralRenderer.render();
41900
41913
  }
41901
41914
  onKeyPress(e) {
41902
- e.code == "Escape" && (vn.clearChildren(this.tempMeasure), this.point1 = null, this.point2 = null, this.tempPoint2 = null, this.viralTools.viralViewerApi.viralRenderer.render());
41915
+ e.code == "Escape" && (bn.clearChildren(this.tempMeasure), this.point1 = null, this.point2 = null, this.tempPoint2 = null, this.viralTools.viralViewerApi.viralRenderer.render());
41903
41916
  }
41904
41917
  }
41905
41918
  class QR {
@@ -42502,6 +42515,10 @@ class n3 {
42502
42515
  this.talkContent = "", this.chatDiv.firstChild && this.chatDiv.removeChild(this.chatDiv.firstChild);
42503
42516
  }, 4e3);
42504
42517
  }
42518
+ teleport(e) {
42519
+ var t;
42520
+ (t = this.avatar) == null || t.position.copy(e);
42521
+ }
42505
42522
  render(e) {
42506
42523
  if (this.avatar && this.mixer) {
42507
42524
  let t = this.avatar.getObjectByName("Hips");
@@ -42586,11 +42603,11 @@ export {
42586
42603
  a3 as Fragment,
42587
42604
  fu as HTMLUtil,
42588
42605
  Sn as LogUtil,
42589
- vn as THREEUtil,
42606
+ bn as THREEUtil,
42590
42607
  oa as ViralCameraEventType,
42591
42608
  EP as ViralInstancedMesh,
42592
42609
  _o as ViralKeyboardEventType,
42593
- Mn as ViralMouseEventType,
42610
+ vn as ViralMouseEventType,
42594
42611
  na as ViralPoint,
42595
42612
  v3 as ViralViewerApi,
42596
42613
  l3 as ViralViewerRevitGeometry,
package/dist/types.d.ts CHANGED
@@ -78,7 +78,8 @@ export declare enum ViralMouseEventType {
78
78
  ON_MOUSE_DOWN_LEFT = 1,
79
79
  ON_MOUSE_UP_LEFT = 2,
80
80
  ON_MOUSE_DOWN_RIGHT = 3,
81
- ON_MOUSE_UP_RIGHT = 4
81
+ ON_MOUSE_UP_RIGHT = 4,
82
+ ON_MOUSE_DOUBLE_CLICK = 5
82
83
  }
83
84
  export declare enum ViralCameraEventType {
84
85
  ON_WAKE = 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viral-viewer-2",
3
- "version": "6.4.7",
3
+ "version": "6.4.9",
4
4
  "description": "",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",