@realsee/dnalogel 2.0.0-alpha.12 → 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 (101) 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/index.js +18 -17
  6. package/dist/ModelRoomLabelPlugin/index.js +67 -26
  7. package/dist/PanoCompassPlugin/index.js +311 -164
  8. package/dist/PanoCursorRaycasterPlugin/index.js +5 -3
  9. package/dist/PanoMeasurePlugin/index.js +1337 -583
  10. package/dist/PanoRulerPlugin/index.js +32 -5
  11. package/dist/PanoSpatialTagPlugin/index.js +64 -29
  12. package/dist/floorplan/ModelFloorplanPlugin/index.js +586 -362
  13. package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
  14. package/dist/floorplan/TopviewFloorplanPlugin/index.js +311 -153
  15. package/dist/index.es.js +2663 -1341
  16. package/dist/index.js +2667 -1345
  17. package/dist/index.umd.js +2667 -1345
  18. package/docs/assets/main.js +1 -1
  19. package/docs/classes/ModelRoomLabelController.html +6 -6
  20. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  21. package/docs/enums/ModelFloorplanErrorType.html +1 -1
  22. package/docs/interfaces/LineJson.html +1 -1
  23. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  24. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  25. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  26. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  27. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  28. package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
  29. package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
  30. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  31. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  32. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  33. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  34. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  35. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  36. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  37. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  38. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  39. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  40. package/docs/interfaces/PointJson.html +1 -1
  41. package/docs/interfaces/RoomLabel.html +7 -7
  42. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
  43. package/docs/modules.html +12 -12
  44. package/libs/CSS3DRenderPlugin/index.js +16 -13
  45. package/libs/CameraMovementPlugin/index.js +24 -15
  46. package/libs/ModelChassisCompassPlugin/index.js +14 -5
  47. package/libs/ModelEntryDoorGuidePlugin/index.js +24 -12
  48. package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +12 -10
  49. package/libs/ModelItemLabelPlugin/index.js +5 -3
  50. package/libs/ModelItemLabelPlugin/utils/parseData.js +1 -4
  51. package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
  52. package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +3 -3
  53. package/libs/PanoCompassPlugin/index.js +225 -128
  54. package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
  55. package/libs/PanoMeasurePlugin/Controller/BaseController.js +68 -13
  56. package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
  57. package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
  58. package/libs/PanoMeasurePlugin/Controller/WatchController.js +234 -152
  59. package/libs/PanoMeasurePlugin/Controller/index.js +131 -47
  60. package/libs/PanoMeasurePlugin/Model/index.js +30 -5
  61. package/libs/PanoMeasurePlugin/Model/line.js +60 -10
  62. package/libs/PanoMeasurePlugin/Model/point.js +24 -4
  63. package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
  64. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +59 -14
  65. package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
  66. package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
  67. package/libs/PanoMeasurePlugin/Modules/Magnifier.js +60 -10
  68. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +83 -37
  69. package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
  70. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +61 -30
  71. package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -2
  72. package/libs/PanoMeasurePlugin/utils/line.js +8 -7
  73. package/libs/PanoRulerPlugin/index.js +16 -5
  74. package/libs/PanoSpatialTagPlugin/index.js +11 -9
  75. package/libs/floorplan/Components/BaseImage.js +10 -5
  76. package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -1
  77. package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +5 -6
  78. package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +7 -2
  79. package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
  80. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +456 -273
  81. package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +33 -22
  82. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +3 -1
  83. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +97 -36
  84. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +231 -108
  85. package/libs/floorplan/utils/formatData.js +43 -28
  86. package/libs/floorplan/utils/formatPosition.js +1 -1
  87. package/libs/shared-utils/Subscribe.js +8 -1
  88. package/libs/shared-utils/animationFrame/BetterTween.js +47 -18
  89. package/libs/shared-utils/createCanvasTextTexture.js +6 -5
  90. package/libs/shared-utils/five/changeMode.js +23 -12
  91. package/libs/shared-utils/getPxmm.js +1 -1
  92. package/libs/shared-utils/math/evenNumber.js +1 -1
  93. package/libs/shared-utils/three/loadFbxObj.js +20 -9
  94. package/libs/shared-utils/three/loadTexture.js +17 -6
  95. package/libs/shared-utils/three/transfromToMeshBasicMaterial.js +2 -1
  96. package/libs/shared-utils/tinyEJSrender.js +36 -6
  97. package/libs/shared-utils/to.js +21 -10
  98. package/libs/shared-utils/useDebounce.js +1 -1
  99. package/libs/shared-utils/useThrottle.js +2 -1
  100. package/package.json +1 -1
  101. package/CHANGELOG.md +0 -41
@@ -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();
@@ -238,8 +238,15 @@ function instance($$self, $$props, $$invalidate) {
238
238
  const getLabelCssOffset = (five, itemLabel) => {
239
239
  const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
240
240
  const cssPosition = five.project2d(modelPosition);
241
- const xOffset = cssPosition?.x;
242
- const yOffset = cssPosition?.y;
241
+
242
+ const xOffset = cssPosition === null || cssPosition === void 0
243
+ ? void 0
244
+ : cssPosition.x;
245
+
246
+ const yOffset = cssPosition === null || cssPosition === void 0
247
+ ? void 0
248
+ : cssPosition.y;
249
+
243
250
  return [xOffset, yOffset];
244
251
  };
245
252
 
@@ -281,18 +288,13 @@ function instance($$self, $$props, $$invalidate) {
281
288
  : true;
282
289
 
283
290
  const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth);
284
- if (!visible) return { ...label, visible };
291
+ if (!visible) return Object.assign(Object.assign({}, label), { visible });
285
292
  cssOffsetLists.push(cssOffset);
286
293
 
287
294
  // position
288
295
  const transform = getLabelTransform(cssOffset);
289
296
 
290
- return {
291
- ...label,
292
- visible,
293
- transform,
294
- strokeLength
295
- };
297
+ return Object.assign(Object.assign({}, label), { visible, transform, strokeLength });
296
298
  });
297
299
 
298
300
  const sortedItemLabelItems = newLabels.filter(({ visible }) => visible).map(label => ({
@@ -302,7 +304,7 @@ function instance($$self, $$props, $$invalidate) {
302
304
 
303
305
  return newLabels.map(label => {
304
306
  const sortIndex = sortedItemLabelItems.findIndex(item => item.itemLabelItem.id === label.id);
305
- if (sortIndex !== undefined) return { ...label, zIndex: sortIndex * 10 };
307
+ if (sortIndex !== undefined) return Object.assign(Object.assign({}, label), { zIndex: sortIndex * 10 });
306
308
  return label;
307
309
  });
308
310
  };
@@ -3,6 +3,7 @@ import ItemLabelComponent from './ItemLabelComponent';
3
3
  import { DISPLAY_STRATEGY_TYPE } from "./typings";
4
4
  import { parseModelItemLabelPluginData } from "./utils/parseData";
5
5
  export const ModelItemLabelPlugin = (five, params) => {
6
+ var _a, _b;
6
7
  const pluginState = {
7
8
  container: document.createElement('div'),
8
9
  data: null,
@@ -12,8 +13,8 @@ export const ModelItemLabelPlugin = (five, params) => {
12
13
  wrapper: null,
13
14
  app: undefined,
14
15
  hooks: new Subscribe(),
15
- modelOcclusionEnable: params?.modelOcclusionEnable ?? true,
16
- displayStrategyType: params?.displayStrategyType ?? DISPLAY_STRATEGY_TYPE.SMALL
16
+ modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
17
+ displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : DISPLAY_STRATEGY_TYPE.SMALL
17
18
  };
18
19
  pluginState.container.setAttribute('class', 'model-item-label-plugin-container');
19
20
  pluginState.container.style.cssText = `
@@ -88,11 +89,12 @@ export const ModelItemLabelPlugin = (five, params) => {
88
89
  render();
89
90
  };
90
91
  const render = () => {
92
+ var _a;
91
93
  if (!pluginState.wrapper)
92
94
  return;
93
95
  // 只要不可展示,销毁容器
94
96
  if (!pluginState.enabled || !pluginState.fiveModeEnabled) {
95
- pluginState.app?.$destroy();
97
+ (_a = pluginState.app) === null || _a === void 0 ? void 0 : _a.$destroy();
96
98
  pluginState.app = undefined;
97
99
  return;
98
100
  }
@@ -1,7 +1,4 @@
1
1
  /** @description 转成内部所需数据 */
2
2
  export function parseModelItemLabelPluginData(data) {
3
- return data.model_item_labels.map(label => ({
4
- modelPosition: [label.position[0], label.position[1] + label.size[1], label.position[2]],
5
- ...label
6
- }));
3
+ return data.model_item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1] + label.size[1], label.position[2]] }, label)));
7
4
  }
@@ -1,14 +1,69 @@
1
1
  import RoomLabelItems from './RoomLabelItems';
2
2
  import { parseModelRoomLabelPluginData } from './utils/parseData';
3
3
  export class ModelRoomLabelController {
4
- five;
5
- enabled = true;
6
- fiveModeEnabled;
7
- app = undefined;
8
- wrapper;
9
- roomLabels = [];
10
- container = document.createElement('div');
11
4
  constructor(five) {
5
+ Object.defineProperty(this, "five", {
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true,
9
+ value: void 0
10
+ });
11
+ Object.defineProperty(this, "enabled", {
12
+ enumerable: true,
13
+ configurable: true,
14
+ writable: true,
15
+ value: true
16
+ });
17
+ Object.defineProperty(this, "fiveModeEnabled", {
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true,
21
+ value: void 0
22
+ });
23
+ Object.defineProperty(this, "app", {
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true,
27
+ value: undefined
28
+ });
29
+ Object.defineProperty(this, "wrapper", {
30
+ enumerable: true,
31
+ configurable: true,
32
+ writable: true,
33
+ value: void 0
34
+ });
35
+ Object.defineProperty(this, "roomLabels", {
36
+ enumerable: true,
37
+ configurable: true,
38
+ writable: true,
39
+ value: []
40
+ });
41
+ Object.defineProperty(this, "container", {
42
+ enumerable: true,
43
+ configurable: true,
44
+ writable: true,
45
+ value: document.createElement('div')
46
+ });
47
+ /** 监听 Five Mode 变化
48
+ * @description
49
+ * Mode 不符合要求时,立刻消失,满足要求时,需要等待动画结束再展示
50
+ */
51
+ Object.defineProperty(this, "onFiveModeChange", {
52
+ enumerable: true,
53
+ configurable: true,
54
+ writable: true,
55
+ value: (mode) => {
56
+ if (mode !== 'Floorplan') {
57
+ this.fiveModeEnabled = false;
58
+ this.render();
59
+ return;
60
+ }
61
+ this.five.once('initAnimationEnded', () => {
62
+ this.fiveModeEnabled = this.five.currentMode === 'Floorplan';
63
+ this.render();
64
+ });
65
+ }
66
+ });
12
67
  this.five = five;
13
68
  this.fiveModeEnabled = this.five.currentMode === 'Floorplan';
14
69
  // init container style
@@ -61,26 +116,12 @@ export class ModelRoomLabelController {
61
116
  this.render();
62
117
  return this;
63
118
  }
64
- /** 监听 Five Mode 变化
65
- * @description
66
- * Mode 不符合要求时,立刻消失,满足要求时,需要等待动画结束再展示
67
- */
68
- onFiveModeChange = (mode) => {
69
- if (mode !== 'Floorplan') {
70
- this.fiveModeEnabled = false;
71
- this.render();
72
- return;
73
- }
74
- this.five.once('initAnimationEnded', () => {
75
- this.fiveModeEnabled = this.five.currentMode === 'Floorplan';
76
- this.render();
77
- });
78
- };
79
119
  render() {
120
+ var _a;
80
121
  if (!this.wrapper)
81
122
  return;
82
123
  if (!this.enabled || !this.fiveModeEnabled) {
83
- this.app?.$destroy();
124
+ (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
84
125
  this.app = undefined;
85
126
  return;
86
127
  }
@@ -194,12 +194,12 @@ function instance($$self, $$props, $$invalidate) {
194
194
  // 计算是否可见,如果不可见,不会更新位置
195
195
  const visible = getLabelVisible(five, roomLabelItem);
196
196
 
197
- if (!visible) return { ...roomLabelItem, visible };
197
+ if (!visible) return Object.assign(Object.assign({}, roomLabelItem), { visible });
198
198
 
199
199
  // 更新位置
200
200
  const transform = getLabelTransform(five, roomLabelItem);
201
201
 
202
- return { ...roomLabelItem, visible, transform };
202
+ return Object.assign(Object.assign({}, roomLabelItem), { visible, transform });
203
203
  });
204
204
 
205
205
  const sortedRoomLabelItems = newLabels.filter(({ visible }) => visible).map(roomLabelItem => ({
@@ -209,7 +209,7 @@ function instance($$self, $$props, $$invalidate) {
209
209
 
210
210
  return newLabels.map(roomLabelItem => {
211
211
  const sortIndex = sortedRoomLabelItems.findIndex(item => item.roomLabelItem.id === roomLabelItem.id);
212
- if (sortIndex !== undefined) return { ...roomLabelItem, zIndex: sortIndex * 10 };
212
+ if (sortIndex !== undefined) return Object.assign(Object.assign({}, roomLabelItem), { zIndex: sortIndex * 10 });
213
213
  return roomLabelItem;
214
214
  });
215
215
  }