@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
@@ -5,6 +5,31 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var five = require('@realsee/five');
6
6
  var three = require('three');
7
7
 
8
+ /*! *****************************************************************************
9
+ Copyright (c) Microsoft Corporation.
10
+
11
+ Permission to use, copy, modify, and/or distribute this software for any
12
+ purpose with or without fee is hereby granted.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
+ PERFORMANCE OF THIS SOFTWARE.
21
+ ***************************************************************************** */
22
+
23
+ function __awaiter(thisArg, _arguments, P, generator) {
24
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
25
+ return new (P || (P = Promise))(function (resolve, reject) {
26
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
27
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
28
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ }
32
+
8
33
  /**
9
34
  * 平面几何相关数学函数
10
35
  */
@@ -376,7 +401,7 @@ const PanoRulerPlugin = (five$1, params) => {
376
401
  state.loaded = true;
377
402
  return true;
378
403
  };
379
- const load = async (_roomInfo, _roomRules, options) => {
404
+ const load = (_roomInfo, _roomRules, options) => __awaiter(void 0, void 0, void 0, function* () {
380
405
  const roomInfo = _roomInfo || params.roomInfo;
381
406
  const roomRules = _roomRules || params.roomRules;
382
407
  if (!roomInfo || !roomRules) {
@@ -387,9 +412,9 @@ const PanoRulerPlugin = (five$1, params) => {
387
412
  return _load(roomInfo, roomRules);
388
413
  }
389
414
  else {
390
- return await new Promise((resolve) => five$1.once('modelLoaded', () => resolve(_load(roomInfo, roomRules))));
415
+ return yield new Promise((resolve) => five$1.once('modelLoaded', () => resolve(_load(roomInfo, roomRules))));
391
416
  }
392
- };
417
+ });
393
418
  if (params.roomInfo && params.roomRules) {
394
419
  load(params.roomInfo, params.roomRules);
395
420
  }
@@ -425,7 +450,8 @@ const PanoRulerPlugin = (five$1, params) => {
425
450
  }
426
451
  };
427
452
  const freshRule = () => {
428
- const element = five$1.getElement()?.parentElement;
453
+ var _a;
454
+ const element = (_a = five$1.getElement()) === null || _a === void 0 ? void 0 : _a.parentElement;
429
455
  if (!element)
430
456
  return;
431
457
  if (!state.loaded)
@@ -562,12 +588,13 @@ const PanoRulerPlugin = (five$1, params) => {
562
588
  const nextFrameFreshRule = () => nextFrame(freshRule);
563
589
  const throttleFreshRule = throttle(freshRule, 80);
564
590
  const enable = () => {
591
+ var _a, _b;
565
592
  if (!state.loaded)
566
593
  return false;
567
594
  if (state.enable)
568
595
  return true;
569
596
  $rule.setAttribute('class', 'PanoRulerPlugin' + (state.options.className ? ' ' + state.options.className : ''));
570
- five$1.getElement()?.parentElement?.append($rule);
597
+ (_b = (_a = five$1.getElement()) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.append($rule);
571
598
  freshRule();
572
599
  five$1.on('panoArrived', freshRule);
573
600
  five$1.on('modeChange', freshRule);
@@ -31,7 +31,7 @@ var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
31
31
 
32
32
  function evenNumber(num, config) {
33
33
  const roundNum = Math.round(num);
34
- return roundNum % 2 === 0 ? roundNum : roundNum + Number(config?.smaller ? -1 : 1);
34
+ return roundNum % 2 === 0 ? roundNum : roundNum + Number((config === null || config === void 0 ? void 0 : config.smaller) ? -1 : 1);
35
35
  }
36
36
 
37
37
  function centerPoint(point1, point2) {
@@ -68,24 +68,25 @@ function createResizeObserver(func, element) {
68
68
  const CSS3DRenderPlugin = (five) => {
69
69
  const state = { disposeCallbacks: [] };
70
70
  const create3DDomContainer = (...params) => {
71
+ var _a, _b, _c;
71
72
  const points = params[0].map((point) => (point instanceof THREE.Vector3 ? point : transformPositionToVector3(point)));
72
73
  const config = params[1];
73
- if (points?.length < 4)
74
+ if ((points === null || points === void 0 ? void 0 : points.length) < 4)
74
75
  return console.error('points must be equal or greater than than 4');
75
- if (!five?.model?.loaded)
76
- return console.error('five.model.loaded is: ', five?.model?.loaded);
76
+ if (!((_a = five === null || five === void 0 ? void 0 : five.model) === null || _a === void 0 ? void 0 : _a.loaded))
77
+ 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);
77
78
  const fiveElement = five.getElement();
78
79
  if (!fiveElement)
79
80
  return console.error('five.getElement() is ' + fiveElement);
80
81
  const disposers = [];
81
- const ratio = config?.ratio || 0.00216;
82
+ const ratio = (config === null || config === void 0 ? void 0 : config.ratio) || 0.00216;
82
83
  if (ratio <= 0.00215)
83
84
  console.warn('if you need click css3DElement on safari, ratio must be greater than 0.00215');
84
- const dpr = config?.dpr || 1;
85
- const mode = config?.mode || 'front';
86
- const autoRender = config?.autoRender ?? true;
87
- const behindFiveContainer = config?.behindFiveContainer || fiveElement.parentElement || document.body;
88
- const container = config?.container || document.createElement('div');
85
+ const dpr = (config === null || config === void 0 ? void 0 : config.dpr) || 1;
86
+ const mode = (config === null || config === void 0 ? void 0 : config.mode) || 'front';
87
+ const autoRender = (_c = config === null || config === void 0 ? void 0 : config.autoRender) !== null && _c !== void 0 ? _c : true;
88
+ const behindFiveContainer = (config === null || config === void 0 ? void 0 : config.behindFiveContainer) || fiveElement.parentElement || document.body;
89
+ const container = (config === null || config === void 0 ? void 0 : config.container) || document.createElement('div');
89
90
  container.classList.add('__Dnalogel-plugin--CSS3DRenderPlugin');
90
91
  // 获取css3DObject, 如果mode为behind的话,一起获取mesh
91
92
  const { css3DObject, mesh } = createObject(points, { ratio, dpr, container, mode });
@@ -123,8 +124,9 @@ const CSS3DRenderPlugin = (five) => {
123
124
  css3DRenderer.render(scene, five.camera);
124
125
  };
125
126
  return () => {
127
+ var _a;
126
128
  scene.add(css3DObject);
127
- resizeObserver?.observe?.();
129
+ (_a = resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.observe) === null || _a === void 0 ? void 0 : _a.call(resizeObserver);
128
130
  renderEveryFrame();
129
131
  if (mode === 'behind' && mesh) {
130
132
  five.scene.add(mesh);
@@ -148,7 +150,8 @@ const CSS3DRenderPlugin = (five) => {
148
150
  }
149
151
  // ======= INIT END =======
150
152
  const dispose = () => {
151
- disposers.forEach((d) => d?.());
153
+ var _a;
154
+ disposers.forEach((d) => d === null || d === void 0 ? void 0 : d());
152
155
  scene.remove(css3DObject);
153
156
  if (scene.children.length === 0) {
154
157
  if (typeof stateMode.requestAnimationFrameId === 'number') {
@@ -160,7 +163,7 @@ const CSS3DRenderPlugin = (five) => {
160
163
  if (mode === 'behind')
161
164
  state.behindMode = undefined;
162
165
  if (!state.behindMode && !state.frontMode) {
163
- resizeObserver?.unobserve?.();
166
+ (_a = resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.unobserve) === null || _a === void 0 ? void 0 : _a.call(resizeObserver);
164
167
  }
165
168
  }
166
169
  return true;
@@ -225,7 +228,7 @@ const CSS3DRenderPlugin = (five) => {
225
228
  return {
226
229
  create3DDomContainer,
227
230
  disposeAll: () => {
228
- state.disposeCallbacks.forEach((d) => d?.());
231
+ state.disposeCallbacks.forEach((d) => d === null || d === void 0 ? void 0 : d());
229
232
  state.disposeCallbacks = [];
230
233
  },
231
234
  };
@@ -697,13 +700,43 @@ function render(template, data) {
697
700
  return templ.compileFunction()(data);
698
701
  }
699
702
  class Template {
700
- templateText;
701
- mode = null;
702
- truncate = false;
703
- currentLine = 1;
704
- source = '';
705
- regex = new RegExp(REGEX_STRING);
706
703
  constructor(text) {
704
+ Object.defineProperty(this, "templateText", {
705
+ enumerable: true,
706
+ configurable: true,
707
+ writable: true,
708
+ value: void 0
709
+ });
710
+ Object.defineProperty(this, "mode", {
711
+ enumerable: true,
712
+ configurable: true,
713
+ writable: true,
714
+ value: null
715
+ });
716
+ Object.defineProperty(this, "truncate", {
717
+ enumerable: true,
718
+ configurable: true,
719
+ writable: true,
720
+ value: false
721
+ });
722
+ Object.defineProperty(this, "currentLine", {
723
+ enumerable: true,
724
+ configurable: true,
725
+ writable: true,
726
+ value: 1
727
+ });
728
+ Object.defineProperty(this, "source", {
729
+ enumerable: true,
730
+ configurable: true,
731
+ writable: true,
732
+ value: ''
733
+ });
734
+ Object.defineProperty(this, "regex", {
735
+ enumerable: true,
736
+ configurable: true,
737
+ writable: true,
738
+ value: new RegExp(REGEX_STRING)
739
+ });
707
740
  this.templateText = text;
708
741
  }
709
742
  compileFunction() {
@@ -861,12 +894,13 @@ const MAX_DISTANCE = 3.5;
861
894
  * 空间游走标签插件
862
895
  */
863
896
  const PanoSpatialTagPlugin = (five$1, params) => {
864
- let wrapper = params?.container;
865
- const wait = params?.wait ?? 200;
866
- const maxNumberOnScreen = params?.maxNumberOnScreen ?? 3;
867
- const minRad = params?.minRad ?? Math.PI / 4;
868
- const nearTolerance = params?.nearTolerance ?? 100;
869
- const upsideHeight = params?.upsideHeight ?? 1.6;
897
+ var _a, _b, _c, _d, _e, _f;
898
+ let wrapper = params === null || params === void 0 ? void 0 : params.container;
899
+ const wait = (_a = params === null || params === void 0 ? void 0 : params.wait) !== null && _a !== void 0 ? _a : 200;
900
+ const maxNumberOnScreen = (_b = params === null || params === void 0 ? void 0 : params.maxNumberOnScreen) !== null && _b !== void 0 ? _b : 3;
901
+ const minRad = (_c = params === null || params === void 0 ? void 0 : params.minRad) !== null && _c !== void 0 ? _c : Math.PI / 4;
902
+ const nearTolerance = (_d = params === null || params === void 0 ? void 0 : params.nearTolerance) !== null && _d !== void 0 ? _d : 100;
903
+ const upsideHeight = (_e = params === null || params === void 0 ? void 0 : params.upsideHeight) !== null && _e !== void 0 ? _e : 1.6;
870
904
  // const foldPercent = params?.foldPercent ?? 20
871
905
  const css3DRender = CSS3DRenderPlugin(five$1);
872
906
  const container = document.createElement('div');
@@ -1124,12 +1158,13 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1124
1158
  */
1125
1159
  const load = (data) => {
1126
1160
  state.points = data.points.map(point => {
1161
+ var _a, _b;
1127
1162
  return {
1128
1163
  id: point.id,
1129
1164
  position: new THREE__namespace.Vector3().fromArray(point.position),
1130
1165
  normal: new THREE__namespace.Vector3().fromArray(point.normal),
1131
- replacement: point.replacement ?? {},
1132
- weight: point.weight ?? -1,
1166
+ replacement: (_a = point.replacement) !== null && _a !== void 0 ? _a : {},
1167
+ weight: (_b = point.weight) !== null && _b !== void 0 ? _b : -1,
1133
1168
  };
1134
1169
  });
1135
1170
  if (data.render)
@@ -1217,7 +1252,7 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1217
1252
  five$1.off('modeChange', onModeChange);
1218
1253
  five$1.off('cameraUpdate', onCameraUpdate);
1219
1254
  };
1220
- if (five$1?.model?.loaded) {
1255
+ if ((_f = five$1 === null || five$1 === void 0 ? void 0 : five$1.model) === null || _f === void 0 ? void 0 : _f.loaded) {
1221
1256
  if (!wrapper)
1222
1257
  wrapper = five$1.getElement().parentElement;
1223
1258
  wrapper.appendChild(container);