@realsee/dnalogel 2.0.0-alpha.10 → 2.0.0-alpha.13

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.
Files changed (123) hide show
  1. package/dist/CSS3DRenderPlugin/index.js +17 -14
  2. package/dist/CameraMovementPlugin/index.js +40 -15
  3. package/dist/ModelChassisCompassPlugin/index.js +32 -6
  4. package/dist/ModelEntryDoorGuidePlugin/index.js +48 -18
  5. package/dist/ModelItemLabelPlugin/events.type.d.ts +9 -0
  6. package/dist/ModelItemLabelPlugin/index.d.ts +4 -0
  7. package/dist/ModelItemLabelPlugin/index.js +679 -0
  8. package/dist/ModelItemLabelPlugin/typings.d.ts +55 -0
  9. package/dist/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
  10. package/dist/ModelRoomLabelPlugin/index.js +71 -28
  11. package/dist/PanoCompassPlugin/index.js +311 -164
  12. package/dist/PanoCursorRaycasterPlugin/index.js +5 -3
  13. package/dist/PanoMeasurePlugin/index.js +1337 -583
  14. package/dist/PanoRulerPlugin/index.js +32 -5
  15. package/dist/PanoSpatialTagPlugin/index.js +73 -38
  16. package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +1 -0
  17. package/dist/floorplan/ModelFloorplanPlugin/index.js +678 -439
  18. package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
  19. package/dist/floorplan/TopviewFloorplanPlugin/Controller.d.ts +1 -0
  20. package/dist/floorplan/TopviewFloorplanPlugin/index.js +403 -230
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.es.js +3596 -1612
  23. package/dist/index.js +3602 -1616
  24. package/dist/index.umd.js +3605 -1620
  25. package/docs/assets/main.js +1 -1
  26. package/docs/assets/search.js +1 -1
  27. package/docs/classes/ModelRoomLabelController.html +6 -6
  28. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  29. package/docs/enums/ModelFloorplanErrorType.html +1 -1
  30. package/docs/index.html +1 -1
  31. package/docs/interfaces/LineJson.html +1 -1
  32. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  33. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  34. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  35. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  36. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  37. package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
  38. package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
  39. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  40. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  41. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  42. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  43. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  44. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  45. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  46. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  47. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  48. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  49. package/docs/interfaces/PointJson.html +1 -1
  50. package/docs/interfaces/RoomLabel.html +7 -7
  51. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
  52. package/docs/modules.html +12 -12
  53. package/libs/CSS3DRenderPlugin/index.js +16 -13
  54. package/libs/CameraMovementPlugin/index.js +24 -15
  55. package/libs/ModelChassisCompassPlugin/index.js +14 -5
  56. package/libs/ModelEntryDoorGuidePlugin/index.js +24 -12
  57. package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +422 -0
  58. package/libs/ModelItemLabelPlugin/ItemLabelItem.js +133 -0
  59. package/libs/ModelItemLabelPlugin/events.type.d.ts +9 -0
  60. package/libs/ModelItemLabelPlugin/events.type.js +1 -0
  61. package/libs/ModelItemLabelPlugin/index.d.ts +4 -0
  62. package/libs/ModelItemLabelPlugin/index.js +172 -0
  63. package/libs/ModelItemLabelPlugin/typings.d.ts +55 -0
  64. package/libs/ModelItemLabelPlugin/typings.js +6 -0
  65. package/libs/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
  66. package/libs/ModelItemLabelPlugin/utils/parseData.js +4 -0
  67. package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
  68. package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +7 -5
  69. package/libs/PanoCompassPlugin/index.js +225 -128
  70. package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
  71. package/libs/PanoMeasurePlugin/Controller/BaseController.js +68 -13
  72. package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
  73. package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
  74. package/libs/PanoMeasurePlugin/Controller/WatchController.js +234 -152
  75. package/libs/PanoMeasurePlugin/Controller/index.js +131 -47
  76. package/libs/PanoMeasurePlugin/Model/index.js +30 -5
  77. package/libs/PanoMeasurePlugin/Model/line.js +60 -10
  78. package/libs/PanoMeasurePlugin/Model/point.js +24 -4
  79. package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
  80. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +59 -14
  81. package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
  82. package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
  83. package/libs/PanoMeasurePlugin/Modules/Magnifier.js +60 -10
  84. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +83 -37
  85. package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
  86. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +61 -30
  87. package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -2
  88. package/libs/PanoMeasurePlugin/utils/line.js +8 -7
  89. package/libs/PanoRulerPlugin/index.js +16 -5
  90. package/libs/PanoSpatialTagPlugin/Components/tag.js +9 -9
  91. package/libs/PanoSpatialTagPlugin/index.js +11 -9
  92. package/libs/floorplan/Components/BaseImage.js +10 -5
  93. package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -1
  94. package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +5 -6
  95. package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +24 -11
  96. package/libs/floorplan/ModelFloorplanPlugin/Components/Main.js +77 -69
  97. package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
  98. package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +1 -0
  99. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +457 -273
  100. package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +33 -22
  101. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +3 -1
  102. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +97 -36
  103. package/libs/floorplan/TopviewFloorplanPlugin/Controller.d.ts +1 -0
  104. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +232 -108
  105. package/libs/floorplan/utils/formatData.js +43 -28
  106. package/libs/floorplan/utils/formatPosition.js +1 -1
  107. package/libs/index.d.ts +1 -0
  108. package/libs/index.js +2 -0
  109. package/libs/shared-utils/Subscribe.js +8 -1
  110. package/libs/shared-utils/animationFrame/BetterTween.js +47 -18
  111. package/libs/shared-utils/createCanvasTextTexture.js +6 -5
  112. package/libs/shared-utils/five/changeMode.js +23 -12
  113. package/libs/shared-utils/getPxmm.js +1 -1
  114. package/libs/shared-utils/math/evenNumber.js +1 -1
  115. package/libs/shared-utils/three/loadFbxObj.js +20 -9
  116. package/libs/shared-utils/three/loadTexture.js +17 -6
  117. package/libs/shared-utils/three/transfromToMeshBasicMaterial.js +2 -1
  118. package/libs/shared-utils/tinyEJSrender.js +36 -6
  119. package/libs/shared-utils/to.js +21 -10
  120. package/libs/shared-utils/useDebounce.js +1 -1
  121. package/libs/shared-utils/useThrottle.js +2 -1
  122. package/package.json +2 -2
  123. package/CHANGELOG.md +0 -34
@@ -14,24 +14,25 @@ import createResizeObserver from './utils/createResizeObserver';
14
14
  export const CSS3DRenderPlugin = (five) => {
15
15
  const state = { disposeCallbacks: [] };
16
16
  const create3DDomContainer = (...params) => {
17
+ var _a, _b, _c;
17
18
  const points = params[0].map((point) => (point instanceof Vector3 ? point : transformPositionToVector3(point)));
18
19
  const config = params[1];
19
- if (points?.length < 4)
20
+ if ((points === null || points === void 0 ? void 0 : points.length) < 4)
20
21
  return console.error('points must be equal or greater than than 4');
21
- if (!five?.model?.loaded)
22
- return console.error('five.model.loaded is: ', five?.model?.loaded);
22
+ if (!((_a = five === null || five === void 0 ? void 0 : five.model) === null || _a === void 0 ? void 0 : _a.loaded))
23
+ return console.error('five.model.loaded is: ', (_b = five === null || five === void 0 ? void 0 : five.model) === null || _b === void 0 ? void 0 : _b.loaded);
23
24
  const fiveElement = five.getElement();
24
25
  if (!fiveElement)
25
26
  return console.error('five.getElement() is ' + fiveElement);
26
27
  const disposers = [];
27
- const ratio = config?.ratio || 0.00216;
28
+ const ratio = (config === null || config === void 0 ? void 0 : config.ratio) || 0.00216;
28
29
  if (ratio <= 0.00215)
29
30
  console.warn('if you need click css3DElement on safari, ratio must be greater than 0.00215');
30
- const dpr = config?.dpr || 1;
31
- const mode = config?.mode || 'front';
32
- const autoRender = config?.autoRender ?? true;
33
- const behindFiveContainer = config?.behindFiveContainer || fiveElement.parentElement || document.body;
34
- const container = config?.container || document.createElement('div');
31
+ const dpr = (config === null || config === void 0 ? void 0 : config.dpr) || 1;
32
+ const mode = (config === null || config === void 0 ? void 0 : config.mode) || 'front';
33
+ const autoRender = (_c = config === null || config === void 0 ? void 0 : config.autoRender) !== null && _c !== void 0 ? _c : true;
34
+ const behindFiveContainer = (config === null || config === void 0 ? void 0 : config.behindFiveContainer) || fiveElement.parentElement || document.body;
35
+ const container = (config === null || config === void 0 ? void 0 : config.container) || document.createElement('div');
35
36
  container.classList.add('__Dnalogel-plugin--CSS3DRenderPlugin');
36
37
  // 获取css3DObject, 如果mode为behind的话,一起获取mesh
37
38
  const { css3DObject, mesh } = createObject(points, { ratio, dpr, container, mode });
@@ -69,8 +70,9 @@ export const CSS3DRenderPlugin = (five) => {
69
70
  css3DRenderer.render(scene, five.camera);
70
71
  };
71
72
  return () => {
73
+ var _a;
72
74
  scene.add(css3DObject);
73
- resizeObserver?.observe?.();
75
+ (_a = resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.observe) === null || _a === void 0 ? void 0 : _a.call(resizeObserver);
74
76
  renderEveryFrame();
75
77
  if (mode === 'behind' && mesh) {
76
78
  five.scene.add(mesh);
@@ -94,7 +96,8 @@ export const CSS3DRenderPlugin = (five) => {
94
96
  }
95
97
  // ======= INIT END =======
96
98
  const dispose = () => {
97
- disposers.forEach((d) => d?.());
99
+ var _a;
100
+ disposers.forEach((d) => d === null || d === void 0 ? void 0 : d());
98
101
  scene.remove(css3DObject);
99
102
  if (scene.children.length === 0) {
100
103
  if (typeof stateMode.requestAnimationFrameId === 'number') {
@@ -106,7 +109,7 @@ export const CSS3DRenderPlugin = (five) => {
106
109
  if (mode === 'behind')
107
110
  state.behindMode = undefined;
108
111
  if (!state.behindMode && !state.frontMode) {
109
- resizeObserver?.unobserve?.();
112
+ (_a = resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.unobserve) === null || _a === void 0 ? void 0 : _a.call(resizeObserver);
110
113
  }
111
114
  }
112
115
  return true;
@@ -171,7 +174,7 @@ export const CSS3DRenderPlugin = (five) => {
171
174
  return {
172
175
  create3DDomContainer,
173
176
  disposeAll: () => {
174
- state.disposeCallbacks.forEach((d) => d?.());
177
+ state.disposeCallbacks.forEach((d) => d === null || d === void 0 ? void 0 : d());
175
178
  state.disposeCallbacks = [];
176
179
  },
177
180
  };
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { Five } from '@realsee/five';
2
11
  import * as TWEEN from '@tweenjs/tween.js';
3
12
  import { tweenProgress } from '../shared-utils/animationFrame/tween';
@@ -29,21 +38,21 @@ const getLongitudeParams = (from, to, rotation) => {
29
38
  */
30
39
  export const CameraMovementPlugin = (five) => {
31
40
  const state = {};
32
- const move = async (args, duration, opts = { preload: true }) => {
41
+ const move = (args, duration, opts = { preload: true }) => __awaiter(void 0, void 0, void 0, function* () {
33
42
  if (state.interruptCallback) {
34
43
  state.interruptCallback(false);
35
44
  }
36
45
  if (opts.asyncStartCallback) {
37
- await opts.asyncStartCallback();
46
+ yield opts.asyncStartCallback();
38
47
  }
39
48
  if (args.mode && args.mode !== five.currentMode) {
40
- await five.changeMode(args.mode);
49
+ yield five.changeMode(args.mode);
41
50
  }
42
51
  if (opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex) {
43
- await five.preloadPano(args.panoIndex);
52
+ yield five.preloadPano(args.panoIndex);
44
53
  }
45
54
  if (opts.asyncEndCallback) {
46
- await opts.asyncEndCallback();
55
+ yield opts.asyncEndCallback();
47
56
  }
48
57
  if (args.panoIndex === undefined &&
49
58
  args.fov === undefined &&
@@ -51,7 +60,7 @@ export const CameraMovementPlugin = (five) => {
51
60
  args.longitude === undefined) {
52
61
  return true;
53
62
  }
54
- return await new Promise((resolve, reject) => {
63
+ return yield new Promise((resolve, reject) => {
55
64
  const panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
56
65
  if (panoIndex !== undefined) {
57
66
  five.moveToPano(panoIndex, Object.assign({
@@ -64,7 +73,7 @@ export const CameraMovementPlugin = (five) => {
64
73
  reject(false);
65
74
  }
66
75
  });
67
- };
76
+ });
68
77
  const getAnimeParams = (args) => {
69
78
  const currentFiveState = five.state;
70
79
  // latitude
@@ -80,20 +89,20 @@ export const CameraMovementPlugin = (five) => {
80
89
  to: { latitude: toLatitude, longitude: toLongitude, fov: toFov },
81
90
  };
82
91
  };
83
- const rotate = async (args, duration, opts = {}) => {
92
+ const rotate = (args, duration, opts = {}) => __awaiter(void 0, void 0, void 0, function* () {
84
93
  if (state.interruptCallback) {
85
94
  state.interruptCallback(false);
86
95
  }
87
96
  if (opts.asyncStartCallback) {
88
- await opts.asyncStartCallback();
97
+ yield opts.asyncStartCallback();
89
98
  }
90
99
  if (five.currentMode !== Five.Mode.Panorama) {
91
- await five.changeMode(Five.Mode.Panorama);
100
+ yield five.changeMode(Five.Mode.Panorama);
92
101
  }
93
102
  if (args.panoIndex !== undefined && args.panoIndex !== five.panoIndex) {
94
103
  if (opts.preload)
95
- await five.preloadPano(args.panoIndex);
96
- await new Promise((resolve, reject) => {
104
+ yield five.preloadPano(args.panoIndex);
105
+ yield new Promise((resolve, reject) => {
97
106
  if (!args.panoIndex) {
98
107
  resolve(true);
99
108
  return;
@@ -105,10 +114,10 @@ export const CameraMovementPlugin = (five) => {
105
114
  });
106
115
  }
107
116
  if (opts.asyncEndCallback) {
108
- await opts.asyncEndCallback();
117
+ yield opts.asyncEndCallback();
109
118
  }
110
119
  const { from, to } = getAnimeParams(args);
111
- return await new Promise((resolve) => {
120
+ return yield new Promise((resolve) => {
112
121
  const onUpdate = ({ progress }) => {
113
122
  const state = {};
114
123
  state.longitude = progressNumber(from.longitude, to.longitude, progress);
@@ -150,7 +159,7 @@ export const CameraMovementPlugin = (five) => {
150
159
  state.interruptCallback(true);
151
160
  }, duration);
152
161
  });
153
- };
162
+ });
154
163
  return {
155
164
  move,
156
165
  rotate,
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import * as THREE from 'three';
2
11
  import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader';
3
12
  import object3d2LocalMatrix from '../shared-utils/object3d2LocalMatrix';
@@ -10,9 +19,9 @@ export const ModelChassisCompassPlugin = (five, params) => {
10
19
  const defaultNorthRad = params.north_rad || undefined;
11
20
  // 局部状态
12
21
  const state = {};
13
- const load = async (data) => {
14
- const fbxUrl = data?.fbx_url || defaultFbxUrl;
15
- const northRad = data?.north_rad || defaultNorthRad;
22
+ const load = (data) => __awaiter(void 0, void 0, void 0, function* () {
23
+ const fbxUrl = (data === null || data === void 0 ? void 0 : data.fbx_url) || defaultFbxUrl;
24
+ const northRad = (data === null || data === void 0 ? void 0 : data.north_rad) || defaultNorthRad;
16
25
  if (!northRad) {
17
26
  throw new Error('"northRad"配置参数缺失:未配置指南针指向!');
18
27
  }
@@ -21,7 +30,7 @@ export const ModelChassisCompassPlugin = (five, params) => {
21
30
  const zOffset = bounding.max.z - bounding.min.z;
22
31
  const maxOffset = Math.max(xOffset, zOffset);
23
32
  const fbxLoader = new FBXLoader();
24
- const object = await fbxLoader.loadAsync(fbxUrl);
33
+ const object = yield fbxLoader.loadAsync(fbxUrl);
25
34
  transfromToMeshBasicMaterial(object, {
26
35
  transparent: true,
27
36
  side: THREE.DoubleSide,
@@ -35,7 +44,7 @@ export const ModelChassisCompassPlugin = (five, params) => {
35
44
  object3d2LocalMatrix(object, { position, rotation, scale });
36
45
  state.object = object;
37
46
  return true;
38
- };
47
+ });
39
48
  const onCameraUpdate = ({ latitude }) => {
40
49
  if (!state.object)
41
50
  return;
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { AnimationMixer, MeshBasicMaterial } from 'three';
2
11
  import * as THREE from 'three';
3
12
  import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader';
@@ -8,31 +17,33 @@ import transfromToMeshBasicMaterial from '../shared-utils/three/transfromToMeshB
8
17
  * 模型入户门引导插件
9
18
  */
10
19
  export const ModelEntryDoorGuidePlugin = (five, params) => {
20
+ var _a, _b, _c;
11
21
  // 局部状态
12
22
  const state = {};
13
- const defaultAnimationEnable = params.animationEnabled ?? true;
14
- const defaultModelPosition = params.position ?? undefined;
15
- const defaultRad = params.rad ?? undefined;
23
+ const defaultAnimationEnable = (_a = params.animationEnabled) !== null && _a !== void 0 ? _a : true;
24
+ const defaultModelPosition = (_b = params.position) !== null && _b !== void 0 ? _b : undefined;
25
+ const defaultRad = (_c = params.rad) !== null && _c !== void 0 ? _c : undefined;
16
26
  const defaultFbxUrl = params.fbx_url || '//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx';
17
27
  const mixers = [];
18
- const load = async (data) => {
19
- const position = data?.position ?? defaultModelPosition;
28
+ const load = (data) => __awaiter(void 0, void 0, void 0, function* () {
29
+ var _d, _e, _f, _g, _h, _j, _k;
30
+ const position = (_d = data === null || data === void 0 ? void 0 : data.position) !== null && _d !== void 0 ? _d : defaultModelPosition;
20
31
  if (!position)
21
32
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): position is undefined`);
22
33
  const modelPosition = transformPositionToVector3(position);
23
- const rad = data?.rad ?? defaultRad;
24
- const fbxUrl = data?.fbx_url ?? defaultFbxUrl;
34
+ const rad = (_e = data === null || data === void 0 ? void 0 : data.rad) !== null && _e !== void 0 ? _e : defaultRad;
35
+ const fbxUrl = (_f = data === null || data === void 0 ? void 0 : data.fbx_url) !== null && _f !== void 0 ? _f : defaultFbxUrl;
25
36
  state.rad = rad;
26
37
  if (rad === undefined)
27
38
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): rad is ${rad}`);
28
39
  // 加载模型
29
- const object = await new FBXLoader().loadAsync(fbxUrl);
40
+ const object = yield new FBXLoader().loadAsync(fbxUrl);
30
41
  // 设置位置
31
42
  object.position.copy(modelPosition);
32
43
  object.rotation.z = rad;
33
44
  object.scale.set(0.8, 0.8, 0.8);
34
45
  transfromToMeshBasicMaterial(object, { transparent: true, side: THREE.DoubleSide });
35
- const textMesh = object.children?.[0]?.children?.[3]?.clone();
46
+ const textMesh = (_k = (_j = (_h = (_g = object.children) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.children) === null || _j === void 0 ? void 0 : _j[3]) === null || _k === void 0 ? void 0 : _k.clone();
36
47
  if (!textMesh)
37
48
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): textMesh is ${textMesh}`);
38
49
  textMesh.material = new MeshBasicMaterial({ transparent: true, map: createCanvasTextTexture('入户门') });
@@ -40,7 +51,7 @@ export const ModelEntryDoorGuidePlugin = (five, params) => {
40
51
  object.children[0].add(textMesh);
41
52
  state.object = object;
42
53
  return true;
43
- };
54
+ });
44
55
  const initAnimation = () => {
45
56
  if (state.animation)
46
57
  return;
@@ -84,16 +95,17 @@ export const ModelEntryDoorGuidePlugin = (five, params) => {
84
95
  };
85
96
  const stop = () => {
86
97
  action.stop();
87
- stopAnimation?.();
98
+ stopAnimation === null || stopAnimation === void 0 ? void 0 : stopAnimation();
88
99
  stopAnimation = undefined;
89
100
  };
90
101
  const animation = { play, stop };
91
102
  state.animation = animation;
92
103
  };
93
104
  const show = (config) => {
105
+ var _a;
94
106
  if (!state.object)
95
107
  return console.error('ModelEntryDoorGuidePlugin.enable(): object is ', state.object);
96
- const animationEnable = config?.animationEnable ?? defaultAnimationEnable;
108
+ const animationEnable = (_a = config === null || config === void 0 ? void 0 : config.animationEnable) !== null && _a !== void 0 ? _a : defaultAnimationEnable;
97
109
  if (animationEnable) {
98
110
  if (!state.animation)
99
111
  initAnimation();