@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
@@ -27,7 +27,7 @@ var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
27
27
 
28
28
  function evenNumber(num, config) {
29
29
  const roundNum = Math.round(num);
30
- return roundNum % 2 === 0 ? roundNum : roundNum + Number(config?.smaller ? -1 : 1);
30
+ return roundNum % 2 === 0 ? roundNum : roundNum + Number((config === null || config === void 0 ? void 0 : config.smaller) ? -1 : 1);
31
31
  }
32
32
 
33
33
  function centerPoint(point1, point2) {
@@ -64,24 +64,25 @@ function createResizeObserver(func, element) {
64
64
  const CSS3DRenderPlugin = (five) => {
65
65
  const state = { disposeCallbacks: [] };
66
66
  const create3DDomContainer = (...params) => {
67
+ var _a, _b, _c;
67
68
  const points = params[0].map((point) => (point instanceof THREE.Vector3 ? point : transformPositionToVector3(point)));
68
69
  const config = params[1];
69
- if (points?.length < 4)
70
+ if ((points === null || points === void 0 ? void 0 : points.length) < 4)
70
71
  return console.error('points must be equal or greater than than 4');
71
- if (!five?.model?.loaded)
72
- return console.error('five.model.loaded is: ', five?.model?.loaded);
72
+ if (!((_a = five === null || five === void 0 ? void 0 : five.model) === null || _a === void 0 ? void 0 : _a.loaded))
73
+ 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);
73
74
  const fiveElement = five.getElement();
74
75
  if (!fiveElement)
75
76
  return console.error('five.getElement() is ' + fiveElement);
76
77
  const disposers = [];
77
- const ratio = config?.ratio || 0.00216;
78
+ const ratio = (config === null || config === void 0 ? void 0 : config.ratio) || 0.00216;
78
79
  if (ratio <= 0.00215)
79
80
  console.warn('if you need click css3DElement on safari, ratio must be greater than 0.00215');
80
- const dpr = config?.dpr || 1;
81
- const mode = config?.mode || 'front';
82
- const autoRender = config?.autoRender ?? true;
83
- const behindFiveContainer = config?.behindFiveContainer || fiveElement.parentElement || document.body;
84
- const container = config?.container || document.createElement('div');
81
+ const dpr = (config === null || config === void 0 ? void 0 : config.dpr) || 1;
82
+ const mode = (config === null || config === void 0 ? void 0 : config.mode) || 'front';
83
+ const autoRender = (_c = config === null || config === void 0 ? void 0 : config.autoRender) !== null && _c !== void 0 ? _c : true;
84
+ const behindFiveContainer = (config === null || config === void 0 ? void 0 : config.behindFiveContainer) || fiveElement.parentElement || document.body;
85
+ const container = (config === null || config === void 0 ? void 0 : config.container) || document.createElement('div');
85
86
  container.classList.add('__Dnalogel-plugin--CSS3DRenderPlugin');
86
87
  // 获取css3DObject, 如果mode为behind的话,一起获取mesh
87
88
  const { css3DObject, mesh } = createObject(points, { ratio, dpr, container, mode });
@@ -119,8 +120,9 @@ const CSS3DRenderPlugin = (five) => {
119
120
  css3DRenderer.render(scene, five.camera);
120
121
  };
121
122
  return () => {
123
+ var _a;
122
124
  scene.add(css3DObject);
123
- resizeObserver?.observe?.();
125
+ (_a = resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.observe) === null || _a === void 0 ? void 0 : _a.call(resizeObserver);
124
126
  renderEveryFrame();
125
127
  if (mode === 'behind' && mesh) {
126
128
  five.scene.add(mesh);
@@ -144,7 +146,8 @@ const CSS3DRenderPlugin = (five) => {
144
146
  }
145
147
  // ======= INIT END =======
146
148
  const dispose = () => {
147
- disposers.forEach((d) => d?.());
149
+ var _a;
150
+ disposers.forEach((d) => d === null || d === void 0 ? void 0 : d());
148
151
  scene.remove(css3DObject);
149
152
  if (scene.children.length === 0) {
150
153
  if (typeof stateMode.requestAnimationFrameId === 'number') {
@@ -156,7 +159,7 @@ const CSS3DRenderPlugin = (five) => {
156
159
  if (mode === 'behind')
157
160
  state.behindMode = undefined;
158
161
  if (!state.behindMode && !state.frontMode) {
159
- resizeObserver?.unobserve?.();
162
+ (_a = resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.unobserve) === null || _a === void 0 ? void 0 : _a.call(resizeObserver);
160
163
  }
161
164
  }
162
165
  return true;
@@ -221,7 +224,7 @@ const CSS3DRenderPlugin = (five) => {
221
224
  return {
222
225
  create3DDomContainer,
223
226
  disposeAll: () => {
224
- state.disposeCallbacks.forEach((d) => d?.());
227
+ state.disposeCallbacks.forEach((d) => d === null || d === void 0 ? void 0 : d());
225
228
  state.disposeCallbacks = [];
226
229
  },
227
230
  };
@@ -25,6 +25,31 @@ function _interopNamespace(e) {
25
25
 
26
26
  var TWEEN__namespace = /*#__PURE__*/_interopNamespace(TWEEN);
27
27
 
28
+ /*! *****************************************************************************
29
+ Copyright (c) Microsoft Corporation.
30
+
31
+ Permission to use, copy, modify, and/or distribute this software for any
32
+ purpose with or without fee is hereby granted.
33
+
34
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
35
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
36
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
37
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
38
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
39
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
40
+ PERFORMANCE OF THIS SOFTWARE.
41
+ ***************************************************************************** */
42
+
43
+ function __awaiter(thisArg, _arguments, P, generator) {
44
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
45
+ return new (P || (P = Promise))(function (resolve, reject) {
46
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
47
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
48
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
49
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
50
+ });
51
+ }
52
+
28
53
  const _requestAnimationFrame = window.requestAnimationFrame || ((fn) => setTimeout(fn, 16));
29
54
  const _cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
30
55
  function nextFrame(fn, delay = 0) {
@@ -170,21 +195,21 @@ const getLongitudeParams = (from, to, rotation) => {
170
195
  */
171
196
  const CameraMovementPlugin = (five$1) => {
172
197
  const state = {};
173
- const move = async (args, duration, opts = { preload: true }) => {
198
+ const move = (args, duration, opts = { preload: true }) => __awaiter(void 0, void 0, void 0, function* () {
174
199
  if (state.interruptCallback) {
175
200
  state.interruptCallback(false);
176
201
  }
177
202
  if (opts.asyncStartCallback) {
178
- await opts.asyncStartCallback();
203
+ yield opts.asyncStartCallback();
179
204
  }
180
205
  if (args.mode && args.mode !== five$1.currentMode) {
181
- await five$1.changeMode(args.mode);
206
+ yield five$1.changeMode(args.mode);
182
207
  }
183
208
  if (opts.preload && args.panoIndex !== undefined && args.panoIndex !== five$1.panoIndex) {
184
- await five$1.preloadPano(args.panoIndex);
209
+ yield five$1.preloadPano(args.panoIndex);
185
210
  }
186
211
  if (opts.asyncEndCallback) {
187
- await opts.asyncEndCallback();
212
+ yield opts.asyncEndCallback();
188
213
  }
189
214
  if (args.panoIndex === undefined &&
190
215
  args.fov === undefined &&
@@ -192,7 +217,7 @@ const CameraMovementPlugin = (five$1) => {
192
217
  args.longitude === undefined) {
193
218
  return true;
194
219
  }
195
- return await new Promise((resolve, reject) => {
220
+ return yield new Promise((resolve, reject) => {
196
221
  const panoIndex = args.panoIndex !== undefined ? args.panoIndex : five$1.panoIndex;
197
222
  if (panoIndex !== undefined) {
198
223
  five$1.moveToPano(panoIndex, Object.assign({
@@ -205,7 +230,7 @@ const CameraMovementPlugin = (five$1) => {
205
230
  reject(false);
206
231
  }
207
232
  });
208
- };
233
+ });
209
234
  const getAnimeParams = (args) => {
210
235
  const currentFiveState = five$1.state;
211
236
  // latitude
@@ -221,20 +246,20 @@ const CameraMovementPlugin = (five$1) => {
221
246
  to: { latitude: toLatitude, longitude: toLongitude, fov: toFov },
222
247
  };
223
248
  };
224
- const rotate = async (args, duration, opts = {}) => {
249
+ const rotate = (args, duration, opts = {}) => __awaiter(void 0, void 0, void 0, function* () {
225
250
  if (state.interruptCallback) {
226
251
  state.interruptCallback(false);
227
252
  }
228
253
  if (opts.asyncStartCallback) {
229
- await opts.asyncStartCallback();
254
+ yield opts.asyncStartCallback();
230
255
  }
231
256
  if (five$1.currentMode !== five.Five.Mode.Panorama) {
232
- await five$1.changeMode(five.Five.Mode.Panorama);
257
+ yield five$1.changeMode(five.Five.Mode.Panorama);
233
258
  }
234
259
  if (args.panoIndex !== undefined && args.panoIndex !== five$1.panoIndex) {
235
260
  if (opts.preload)
236
- await five$1.preloadPano(args.panoIndex);
237
- await new Promise((resolve, reject) => {
261
+ yield five$1.preloadPano(args.panoIndex);
262
+ yield new Promise((resolve, reject) => {
238
263
  if (!args.panoIndex) {
239
264
  resolve(true);
240
265
  return;
@@ -246,10 +271,10 @@ const CameraMovementPlugin = (five$1) => {
246
271
  });
247
272
  }
248
273
  if (opts.asyncEndCallback) {
249
- await opts.asyncEndCallback();
274
+ yield opts.asyncEndCallback();
250
275
  }
251
276
  const { from, to } = getAnimeParams(args);
252
- return await new Promise((resolve) => {
277
+ return yield new Promise((resolve) => {
253
278
  const onUpdate = ({ progress }) => {
254
279
  const state = {};
255
280
  state.longitude = progressNumber(from.longitude, to.longitude, progress);
@@ -291,7 +316,7 @@ const CameraMovementPlugin = (five$1) => {
291
316
  state.interruptCallback(true);
292
317
  }, duration);
293
318
  });
294
- };
319
+ });
295
320
  return {
296
321
  move,
297
322
  rotate,
@@ -25,6 +25,31 @@ function _interopNamespace(e) {
25
25
 
26
26
  var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
27
27
 
28
+ /*! *****************************************************************************
29
+ Copyright (c) Microsoft Corporation.
30
+
31
+ Permission to use, copy, modify, and/or distribute this software for any
32
+ purpose with or without fee is hereby granted.
33
+
34
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
35
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
36
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
37
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
38
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
39
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
40
+ PERFORMANCE OF THIS SOFTWARE.
41
+ ***************************************************************************** */
42
+
43
+ function __awaiter(thisArg, _arguments, P, generator) {
44
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
45
+ return new (P || (P = Promise))(function (resolve, reject) {
46
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
47
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
48
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
49
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
50
+ });
51
+ }
52
+
28
53
  const genRotationMatrix = (x, y, z) => {
29
54
  const matrix = new THREE__namespace.Matrix4();
30
55
  const euler = new THREE__namespace.Euler(x, y, z, 'YXZ');
@@ -55,12 +80,13 @@ const bject3d2LocalMatrix = (mesh, { scale, rotation, position, }) => {
55
80
 
56
81
  function transfromToMeshBasicMaterial(object, options) {
57
82
  object.traverse((ele) => {
83
+ var _a;
58
84
  if (ele.type === 'Mesh') {
59
85
  const mesh = ele;
60
86
  const materialConf = Object.assign({ map: mesh.material.map || {} }, options);
61
87
  mesh.material = new THREE.MeshBasicMaterial(materialConf);
62
88
  mesh.renderOrder = 1;
63
- if (ele.parent?.type === 'Mesh') {
89
+ if (((_a = ele.parent) === null || _a === void 0 ? void 0 : _a.type) === 'Mesh') {
64
90
  ele.renderOrder = ele.parent.renderOrder + 1;
65
91
  }
66
92
  }
@@ -75,9 +101,9 @@ const ModelChassisCompassPlugin = (five, params) => {
75
101
  const defaultNorthRad = params.north_rad || undefined;
76
102
  // 局部状态
77
103
  const state = {};
78
- const load = async (data) => {
79
- const fbxUrl = data?.fbx_url || defaultFbxUrl;
80
- const northRad = data?.north_rad || defaultNorthRad;
104
+ const load = (data) => __awaiter(void 0, void 0, void 0, function* () {
105
+ const fbxUrl = (data === null || data === void 0 ? void 0 : data.fbx_url) || defaultFbxUrl;
106
+ const northRad = (data === null || data === void 0 ? void 0 : data.north_rad) || defaultNorthRad;
81
107
  if (!northRad) {
82
108
  throw new Error('"northRad"配置参数缺失:未配置指南针指向!');
83
109
  }
@@ -86,7 +112,7 @@ const ModelChassisCompassPlugin = (five, params) => {
86
112
  const zOffset = bounding.max.z - bounding.min.z;
87
113
  const maxOffset = Math.max(xOffset, zOffset);
88
114
  const fbxLoader = new FBXLoader.FBXLoader();
89
- const object = await fbxLoader.loadAsync(fbxUrl);
115
+ const object = yield fbxLoader.loadAsync(fbxUrl);
90
116
  transfromToMeshBasicMaterial(object, {
91
117
  transparent: true,
92
118
  side: THREE__namespace.DoubleSide,
@@ -100,7 +126,7 @@ const ModelChassisCompassPlugin = (five, params) => {
100
126
  bject3d2LocalMatrix(object, { position, rotation, scale });
101
127
  state.object = object;
102
128
  return true;
103
- };
129
+ });
104
130
  const onCameraUpdate = ({ latitude }) => {
105
131
  if (!state.object)
106
132
  return;
@@ -25,12 +25,38 @@ function _interopNamespace(e) {
25
25
 
26
26
  var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
27
27
 
28
+ /*! *****************************************************************************
29
+ Copyright (c) Microsoft Corporation.
30
+
31
+ Permission to use, copy, modify, and/or distribute this software for any
32
+ purpose with or without fee is hereby granted.
33
+
34
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
35
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
36
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
37
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
38
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
39
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
40
+ PERFORMANCE OF THIS SOFTWARE.
41
+ ***************************************************************************** */
42
+
43
+ function __awaiter(thisArg, _arguments, P, generator) {
44
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
45
+ return new (P || (P = Promise))(function (resolve, reject) {
46
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
47
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
48
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
49
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
50
+ });
51
+ }
52
+
28
53
  function createCanvasTextTexture(text, config) {
29
- const size = config?.size ?? 512;
30
- const fontSize = config?.fontSize ?? size * (35 / 256) * 1.2;
31
- const backgroundColor = config?.backgroundColor ?? 'rgba(0,0,0,0)';
32
- const fontColor = config?.fontColor ?? '#fff';
33
- const textAlign = config?.textAlign ?? 'center';
54
+ var _a, _b, _c, _d, _e;
55
+ const size = (_a = config === null || config === void 0 ? void 0 : config.size) !== null && _a !== void 0 ? _a : 512;
56
+ const fontSize = (_b = config === null || config === void 0 ? void 0 : config.fontSize) !== null && _b !== void 0 ? _b : size * (35 / 256) * 1.2;
57
+ const backgroundColor = (_c = config === null || config === void 0 ? void 0 : config.backgroundColor) !== null && _c !== void 0 ? _c : 'rgba(0,0,0,0)';
58
+ const fontColor = (_d = config === null || config === void 0 ? void 0 : config.fontColor) !== null && _d !== void 0 ? _d : '#fff';
59
+ const textAlign = (_e = config === null || config === void 0 ? void 0 : config.textAlign) !== null && _e !== void 0 ? _e : 'center';
34
60
  const canvas = document.createElement('canvas');
35
61
  canvas.setAttribute('width', size + '');
36
62
  canvas.setAttribute('height', size + '');
@@ -48,12 +74,13 @@ const transformPositionToVector3 = ({ x, y, z }) => new THREE.Vector3(x, y, z);
48
74
 
49
75
  function transfromToMeshBasicMaterial(object, options) {
50
76
  object.traverse((ele) => {
77
+ var _a;
51
78
  if (ele.type === 'Mesh') {
52
79
  const mesh = ele;
53
80
  const materialConf = Object.assign({ map: mesh.material.map || {} }, options);
54
81
  mesh.material = new THREE.MeshBasicMaterial(materialConf);
55
82
  mesh.renderOrder = 1;
56
- if (ele.parent?.type === 'Mesh') {
83
+ if (((_a = ele.parent) === null || _a === void 0 ? void 0 : _a.type) === 'Mesh') {
57
84
  ele.renderOrder = ele.parent.renderOrder + 1;
58
85
  }
59
86
  }
@@ -64,31 +91,33 @@ function transfromToMeshBasicMaterial(object, options) {
64
91
  * 模型入户门引导插件
65
92
  */
66
93
  const ModelEntryDoorGuidePlugin = (five, params) => {
94
+ var _a, _b, _c;
67
95
  // 局部状态
68
96
  const state = {};
69
- const defaultAnimationEnable = params.animationEnabled ?? true;
70
- const defaultModelPosition = params.position ?? undefined;
71
- const defaultRad = params.rad ?? undefined;
97
+ const defaultAnimationEnable = (_a = params.animationEnabled) !== null && _a !== void 0 ? _a : true;
98
+ const defaultModelPosition = (_b = params.position) !== null && _b !== void 0 ? _b : undefined;
99
+ const defaultRad = (_c = params.rad) !== null && _c !== void 0 ? _c : undefined;
72
100
  const defaultFbxUrl = params.fbx_url || '//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx';
73
101
  const mixers = [];
74
- const load = async (data) => {
75
- const position = data?.position ?? defaultModelPosition;
102
+ const load = (data) => __awaiter(void 0, void 0, void 0, function* () {
103
+ var _d, _e, _f, _g, _h, _j, _k;
104
+ const position = (_d = data === null || data === void 0 ? void 0 : data.position) !== null && _d !== void 0 ? _d : defaultModelPosition;
76
105
  if (!position)
77
106
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): position is undefined`);
78
107
  const modelPosition = transformPositionToVector3(position);
79
- const rad = data?.rad ?? defaultRad;
80
- const fbxUrl = data?.fbx_url ?? defaultFbxUrl;
108
+ const rad = (_e = data === null || data === void 0 ? void 0 : data.rad) !== null && _e !== void 0 ? _e : defaultRad;
109
+ const fbxUrl = (_f = data === null || data === void 0 ? void 0 : data.fbx_url) !== null && _f !== void 0 ? _f : defaultFbxUrl;
81
110
  state.rad = rad;
82
111
  if (rad === undefined)
83
112
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): rad is ${rad}`);
84
113
  // 加载模型
85
- const object = await new FBXLoader.FBXLoader().loadAsync(fbxUrl);
114
+ const object = yield new FBXLoader.FBXLoader().loadAsync(fbxUrl);
86
115
  // 设置位置
87
116
  object.position.copy(modelPosition);
88
117
  object.rotation.z = rad;
89
118
  object.scale.set(0.8, 0.8, 0.8);
90
119
  transfromToMeshBasicMaterial(object, { transparent: true, side: THREE__namespace.DoubleSide });
91
- const textMesh = object.children?.[0]?.children?.[3]?.clone();
120
+ 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();
92
121
  if (!textMesh)
93
122
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): textMesh is ${textMesh}`);
94
123
  textMesh.material = new THREE.MeshBasicMaterial({ transparent: true, map: createCanvasTextTexture('入户门') });
@@ -96,7 +125,7 @@ const ModelEntryDoorGuidePlugin = (five, params) => {
96
125
  object.children[0].add(textMesh);
97
126
  state.object = object;
98
127
  return true;
99
- };
128
+ });
100
129
  const initAnimation = () => {
101
130
  if (state.animation)
102
131
  return;
@@ -140,16 +169,17 @@ const ModelEntryDoorGuidePlugin = (five, params) => {
140
169
  };
141
170
  const stop = () => {
142
171
  action.stop();
143
- stopAnimation?.();
172
+ stopAnimation === null || stopAnimation === void 0 ? void 0 : stopAnimation();
144
173
  stopAnimation = undefined;
145
174
  };
146
175
  const animation = { play, stop };
147
176
  state.animation = animation;
148
177
  };
149
178
  const show = (config) => {
179
+ var _a;
150
180
  if (!state.object)
151
181
  return console.error('ModelEntryDoorGuidePlugin.enable(): object is ', state.object);
152
- const animationEnable = config?.animationEnable ?? defaultAnimationEnable;
182
+ const animationEnable = (_a = config === null || config === void 0 ? void 0 : config.animationEnable) !== null && _a !== void 0 ? _a : defaultAnimationEnable;
153
183
  if (animationEnable) {
154
184
  if (!state.animation)
155
185
  initAnimation();
@@ -0,0 +1,9 @@
1
+ import { SubscribeEventMap } from '@realsee/five';
2
+ import { ItemLabel } from "./typings";
3
+ export interface ItemLabelEvent extends SubscribeEventMap {
4
+ /**
5
+ * 点击标签
6
+ */
7
+ onLabelClick: (itemLabel: ItemLabel) => void;
8
+ }
9
+ export declare type PluginEvent = ItemLabelEvent;
@@ -0,0 +1,4 @@
1
+ import type { FivePlugin } from "@realsee/five";
2
+ import { ModelItemLabelPluginExportReturnsType, ModelItemLabelPluginParametersType } from "./typings";
3
+ export declare const ModelItemLabelPlugin: FivePlugin<ModelItemLabelPluginParametersType, ModelItemLabelPluginExportReturnsType>;
4
+ export default ModelItemLabelPlugin;