viral-viewer-2 6.4.3 → 6.4.5

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.
@@ -4,5 +4,5 @@ export declare class ViralAvatarManager {
4
4
  private viralViewerApi;
5
5
  avatars: ViralAvatar[];
6
6
  constructor(viralViewerApi: ViralViewerApi);
7
- load(avatarGLBUrl: string, idleUrl: string, walkUrl: string): ViralAvatar;
7
+ load(avatarGLBUrl: string, idleUrl: string, walkUrl: string, id?: string): ViralAvatar;
8
8
  }
@@ -8,7 +8,8 @@ export declare class ViralAvatar {
8
8
  private avatar;
9
9
  private destination;
10
10
  isReady: boolean;
11
- constructor(viralViewerApi: ViralViewerApi, avatarGLBUrl: string, idleUrl: string, walkUrl: string);
11
+ id: string;
12
+ constructor(viralViewerApi: ViralViewerApi, avatarGLBUrl: string, idleUrl: string, walkUrl: string, id?: string);
12
13
  idle(): void;
13
14
  walk(): void;
14
15
  render(delta: number): void;
package/dist/index.mjs CHANGED
@@ -1,19 +1,19 @@
1
- class s3 {
1
+ class r3 {
2
2
  constructor() {
3
3
  this.MaterialIndex = 0, this.Vertices = [], this.Indices = [], this.Name = "", this.Instances = [];
4
4
  }
5
5
  }
6
- class r3 {
6
+ class a3 {
7
7
  constructor() {
8
8
  this.MaterialIndex = 0, this.Elements = [];
9
9
  }
10
10
  }
11
- class a3 {
11
+ class o3 {
12
12
  constructor() {
13
13
  this.Vertices = [], this.Indices = [], this.Instances = [], this.Id = "";
14
14
  }
15
15
  }
16
- class o3 {
16
+ class l3 {
17
17
  constructor() {
18
18
  this.Vertices = [], this.Indices = [], this.Transform = null;
19
19
  }
@@ -60,12 +60,12 @@ class Pl {
60
60
  return Object.keys(this.items).length;
61
61
  }
62
62
  }
63
- class l3 {
63
+ class c3 {
64
64
  constructor() {
65
65
  this.Solids = [], this.Id = "", this.Instances = [];
66
66
  }
67
67
  }
68
- class c3 {
68
+ class h3 {
69
69
  constructor() {
70
70
  this.MaterialIndex = 0, this.Vertices = [], this.Indices = [], this.Buffer = [];
71
71
  }
@@ -80,7 +80,7 @@ class Zx {
80
80
  this.min = new na(), this.max = new na();
81
81
  }
82
82
  }
83
- class h3 {
83
+ class u3 {
84
84
  constructor() {
85
85
  this.Data = {}, this.CameraData = new qx();
86
86
  }
@@ -1808,7 +1808,7 @@ var yw = oc, xw = kf, vw = gw, bw = kf, ww = rc, _w = {
1808
1808
  ungzip: bw,
1809
1809
  constants: ww
1810
1810
  };
1811
- const { Inflate: u3, inflate: Mw, inflateRaw: d3, ungzip: f3 } = _w;
1811
+ const { Inflate: d3, inflate: Mw, inflateRaw: f3, ungzip: p3 } = _w;
1812
1812
  var Sw = Mw;
1813
1813
  class Aw {
1814
1814
  pakoUnzip(e) {
@@ -42450,22 +42450,33 @@ class e3 {
42450
42450
  this.viralViewerApi.viralCamera.focusModelByName();
42451
42451
  }
42452
42452
  }
42453
- const t3 = 0.064;
42454
- class i3 {
42455
- constructor(e, t, i, s) {
42456
- this.viralViewerApi = e, this.mixer = null, this.idleAnimation = null, this.walkAnimation = null, this.avatar = null, this.destination = null, this.isReady = !1, this.viralViewerApi.viralLoader.threeLoader.loadGLTF(
42453
+ class t3 {
42454
+ static generateRandomString(e) {
42455
+ const t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
42456
+ let i = "";
42457
+ for (let s = 0; s < e; s++) {
42458
+ const r = Math.floor(Math.random() * t.length);
42459
+ i += t[r];
42460
+ }
42461
+ return i;
42462
+ }
42463
+ }
42464
+ const i3 = 0.064;
42465
+ class n3 {
42466
+ constructor(e, t, i, s, r) {
42467
+ this.viralViewerApi = e, this.mixer = null, this.idleAnimation = null, this.walkAnimation = null, this.avatar = null, this.destination = null, this.isReady = !1, this.id = t3.generateRandomString(10), r && (this.id = r), this.viralViewerApi.viralLoader.threeLoader.loadGLTF(
42457
42468
  t,
42458
- (r) => {
42459
- this.avatar = r.scene;
42460
- let a = new G(2, 2, 2);
42461
- this.avatar.scale.copy(a), this.mixer = new R2(r.scene), this.viralViewerApi.viralScene.scene.add(r.scene), this.viralViewerApi.viralRenderer.render(), this.viralViewerApi.viralLoader.threeLoader.loadGLTF(
42469
+ (a) => {
42470
+ this.avatar = a.scene;
42471
+ let l = new G(2, 2, 2);
42472
+ this.avatar.scale.copy(l), this.mixer = new R2(a.scene), this.viralViewerApi.viralScene.scene.add(a.scene), this.viralViewerApi.viralRenderer.render(), this.viralViewerApi.viralLoader.threeLoader.loadGLTF(
42462
42473
  i,
42463
- (l) => {
42464
- this.idleAnimation = this.mixer.clipAction(l.animations[0]), this.viralViewerApi.viralLoader.threeLoader.loadGLTF(
42474
+ (h) => {
42475
+ this.idleAnimation = this.mixer.clipAction(h.animations[0]), this.viralViewerApi.viralLoader.threeLoader.loadGLTF(
42465
42476
  s,
42466
- (h) => {
42477
+ (u) => {
42467
42478
  this.walkAnimation = this.mixer.clipAction(
42468
- h.animations[0]
42479
+ u.animations[0]
42469
42480
  ), Sn.information("load avatar succeed!"), this.isReady = !0, this.idle();
42470
42481
  }
42471
42482
  );
@@ -42484,7 +42495,7 @@ class i3 {
42484
42495
  if (this.avatar && this.mixer) {
42485
42496
  let t = this.avatar.getObjectByName("Hips");
42486
42497
  if (this.mixer.update(e), t.position.set(0, t.position.y, 0), this.destination && this.avatar.position.distanceTo(this.destination) > 0.1) {
42487
- const i = this.avatar.position.clone().sub(this.destination).normalize().multiplyScalar(t3);
42498
+ const i = this.avatar.position.clone().sub(this.destination).normalize().multiplyScalar(i3);
42488
42499
  this.avatar.position.sub(i), this.avatar.lookAt(this.destination), this.idle();
42489
42500
  } else
42490
42501
  this.walk();
@@ -42494,21 +42505,22 @@ class i3 {
42494
42505
  this.destination = e;
42495
42506
  }
42496
42507
  }
42497
- class n3 {
42508
+ class s3 {
42498
42509
  constructor(e) {
42499
42510
  this.viralViewerApi = e, this.avatars = [];
42500
42511
  }
42501
- load(e, t, i) {
42502
- let s = new i3(
42512
+ load(e, t, i, s) {
42513
+ let r = new n3(
42503
42514
  this.viralViewerApi,
42504
42515
  e,
42505
42516
  t,
42506
- i
42517
+ i,
42518
+ s
42507
42519
  );
42508
- return this.avatars.push(s), s;
42520
+ return this.avatars.push(r), r;
42509
42521
  }
42510
42522
  }
42511
- class x3 {
42523
+ class v3 {
42512
42524
  constructor(e = {
42513
42525
  isDev: !1,
42514
42526
  cameraZUp: !1,
@@ -42520,7 +42532,7 @@ class x3 {
42520
42532
  this.lifeCycleEvent = new RR(), this.viralCompressProcessor = new Aw(), this.localStorageService = new pP(), this.viralStats = null, this.options = e, this.viralLifecycleEventHandler = new LR(
42521
42533
  this.lifeCycleEvent,
42522
42534
  this.options
42523
- ), this.targetElement = e.container, IR("QUICK_SAND"), DR(this.targetElement, "QUICK_SAND"), this.options.enableNavigationCube && (this.viralNavigationCube = new e3(this)), this.options.enableTools && (this.viralTools = new qR(this)), this.viralSpinner = new FR(this), this.viralDraggableModal = new XR(this), this.viralContextMenu = new gP(this), this.viralScene = new G2(this), this.viralMaterialManager = new CR(this), this.viralRenderer = new dP(this), this.viralCamera = new O2(this), this.viralMouse = new N2(this), this.viralKeyboard = new mP(this), this.viralAnimation = new fP(this), this.viralVisibilityManager = new OR(this), this.viralCentralizedEventHandler = new yP(this), this.viralLoader = new bC(this), this.viralBVH = new PR(), this.viralDataManager = new kR(this), this.viralAvatarManager = new n3(this), this.options.isDev && (this.viralStats = new wC(this)), this.options.isDev ? this.viralAnimation.devAnimation() : this.viralAnimation.animation();
42535
+ ), this.targetElement = e.container, IR("QUICK_SAND"), DR(this.targetElement, "QUICK_SAND"), this.options.enableNavigationCube && (this.viralNavigationCube = new e3(this)), this.options.enableTools && (this.viralTools = new qR(this)), this.viralSpinner = new FR(this), this.viralDraggableModal = new XR(this), this.viralContextMenu = new gP(this), this.viralScene = new G2(this), this.viralMaterialManager = new CR(this), this.viralRenderer = new dP(this), this.viralCamera = new O2(this), this.viralMouse = new N2(this), this.viralKeyboard = new mP(this), this.viralAnimation = new fP(this), this.viralVisibilityManager = new OR(this), this.viralCentralizedEventHandler = new yP(this), this.viralLoader = new bC(this), this.viralBVH = new PR(), this.viralDataManager = new kR(this), this.viralAvatarManager = new s3(this), this.options.isDev && (this.viralStats = new wC(this)), this.options.isDev ? this.viralAnimation.devAnimation() : this.viralAnimation.animation();
42524
42536
  let t = window;
42525
42537
  t.VIRAL_VIEWER = this;
42526
42538
  }
@@ -42528,8 +42540,8 @@ class x3 {
42528
42540
  export {
42529
42541
  jx as DebouncedEventHandler,
42530
42542
  Pl as Dictionary,
42531
- a3 as ElementFragment,
42532
- r3 as Fragment,
42543
+ o3 as ElementFragment,
42544
+ a3 as Fragment,
42533
42545
  fu as HTMLUtil,
42534
42546
  Sn as LogUtil,
42535
42547
  vn as THREEUtil,
@@ -42538,13 +42550,13 @@ export {
42538
42550
  _o as ViralKeyboardEventType,
42539
42551
  Mn as ViralMouseEventType,
42540
42552
  na as ViralPoint,
42541
- x3 as ViralViewerApi,
42542
- o3 as ViralViewerRevitGeometry,
42543
- s3 as ViralViewerRevitNoneStructuralGeometry,
42553
+ v3 as ViralViewerApi,
42554
+ l3 as ViralViewerRevitGeometry,
42555
+ r3 as ViralViewerRevitNoneStructuralGeometry,
42544
42556
  Zx as ViralutionBox,
42545
42557
  qx as ViralutionCamera,
42546
- l3 as ViralutionElement,
42558
+ c3 as ViralutionElement,
42547
42559
  Pi as ViralutionEvent,
42548
- c3 as ViralutionSolid,
42549
- h3 as ViralutionTrackingModel
42560
+ h3 as ViralutionSolid,
42561
+ u3 as ViralutionTrackingModel
42550
42562
  };
@@ -0,0 +1,3 @@
1
+ export declare class StringUtil {
2
+ static generateRandomString(length: number): string;
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viral-viewer-2",
3
- "version": "6.4.3",
3
+ "version": "6.4.5",
4
4
  "description": "",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "build": "npx tsc",
14
14
  "bundle-webpack": "webpack --config webpack.config.js",
15
15
  "bundle-vite": "npx vite build",
16
- "deploy": "npm run build && npm publish"
16
+ "deploy": "npm run bundle-vite && npm publish"
17
17
  },
18
18
  "keywords": [],
19
19
  "author": "",