@realsee/dnalogel 2.0.0-alpha.42 → 2.0.0-alpha.43

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 (130) hide show
  1. package/dist/CSS3DRenderPlugin/PanoCompassPlugin/index.d.ts +1 -1
  2. package/dist/CameraMovementPlugin/PanoCompassPlugin/index.d.ts +1 -1
  3. package/dist/CameraMovementPlugin/index.js +15 -40
  4. package/dist/ItemLabelPlugin/PanoCompassPlugin/index.d.ts +1 -1
  5. package/dist/ModelChassisCompassPlugin/PanoCompassPlugin/index.d.ts +1 -1
  6. package/dist/ModelChassisCompassPlugin/index.js +5 -30
  7. package/dist/ModelEntryDoorGuidePlugin/PanoCompassPlugin/index.d.ts +1 -1
  8. package/dist/ModelEntryDoorGuidePlugin/index.js +8 -33
  9. package/dist/ModelItemLabelPlugin/PanoCompassPlugin/index.d.ts +1 -1
  10. package/dist/ModelRoomLabelPlugin/PanoCompassPlugin/index.d.ts +1 -1
  11. package/dist/ModelTVVideoPlugin/PanoCompassPlugin/index.d.ts +1 -1
  12. package/dist/ModelTVVideoPlugin/index.js +3 -28
  13. package/dist/ModelViewPlugin/PanoCompassPlugin/index.d.ts +1 -1
  14. package/dist/PanoCompassPlugin/PanoCompassPlugin/index.d.ts +1 -1
  15. package/dist/PanoCompassPlugin/index.d.ts +1 -1
  16. package/dist/PanoCompassPlugin/index.js +64 -99
  17. package/dist/PanoCursorRaycasterPlugin/PanoCompassPlugin/index.d.ts +1 -1
  18. package/dist/PanoMeasurePlugin/PanoCompassPlugin/index.d.ts +1 -1
  19. package/dist/PanoRulerPlugin/PanoCompassPlugin/index.d.ts +1 -1
  20. package/dist/PanoRulerPlugin/index.js +3 -28
  21. package/dist/PanoRulerProPlugin/PanoCompassPlugin/index.d.ts +1 -1
  22. package/dist/PanoRulerProPlugin/index.js +29 -58
  23. package/dist/PanoSpatialTagPlugin/PanoCompassPlugin/index.d.ts +1 -1
  24. package/dist/floorplan/ModelFloorplanPlugin/PanoCompassPlugin/index.d.ts +1 -1
  25. package/dist/floorplan/ModelFloorplanPlugin/index.js +115 -156
  26. package/dist/floorplan/PanoFloorplanRadarPlugin/PanoCompassPlugin/index.d.ts +1 -1
  27. package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +71 -110
  28. package/dist/floorplan/TopviewFloorplanPlugin/PanoCompassPlugin/index.d.ts +1 -1
  29. package/dist/floorplan/TopviewFloorplanPlugin/index.js +114 -159
  30. package/dist/index.es.js +341 -416
  31. package/dist/index.js +341 -416
  32. package/dist/index.umd.js +341 -416
  33. package/docs/assets/search.js +1 -1
  34. package/docs/classes/Magnifier.html +4 -4
  35. package/docs/classes/ModelRoomLabelController.html +4 -4
  36. package/docs/enums/CameraMovementEffect.html +2 -2
  37. package/docs/enums/DIRECTION.html +1 -1
  38. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  39. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  40. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  41. package/docs/enums/Rotation.html +2 -2
  42. package/docs/index.html +2 -2
  43. package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
  44. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  45. package/docs/interfaces/FloorplanBounding.html +4 -4
  46. package/docs/interfaces/FloorplanData.html +2 -2
  47. package/docs/interfaces/FloorplanEntrance.html +7 -7
  48. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  49. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  50. package/docs/interfaces/FloorplanFloorData.html +2 -2
  51. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  52. package/docs/interfaces/FloorplanObserver.html +2 -2
  53. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  54. package/docs/interfaces/FloorplanPosition.html +2 -2
  55. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  56. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  57. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  58. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  59. package/docs/interfaces/FloorplanServerData.html +2 -2
  60. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  61. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  62. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  63. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  64. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  65. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  66. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  67. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  68. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  69. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  70. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  71. package/docs/interfaces/LineJson.html +1 -1
  72. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  73. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  74. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  75. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  76. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  77. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  78. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  79. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  80. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  81. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  82. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  83. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  84. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  85. package/docs/interfaces/OpenParameter.html +2 -2
  86. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  87. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  88. package/docs/interfaces/PanoMeasureParameterType.html +1 -1
  89. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  90. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  91. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  92. package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
  93. package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
  94. package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
  95. package/docs/interfaces/PanoRulerProPluginState.html +1 -1
  96. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  97. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  98. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  99. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  100. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  101. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  102. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  103. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  104. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  105. package/docs/interfaces/Point.html +1 -1
  106. package/docs/interfaces/PointJson.html +1 -1
  107. package/docs/interfaces/Room.html +1 -1
  108. package/docs/interfaces/RoomInfo.html +1 -1
  109. package/docs/interfaces/RoomLabel.html +7 -7
  110. package/docs/interfaces/RoomRules.html +1 -1
  111. package/docs/interfaces/Rooms.html +1 -1
  112. package/docs/modules.html +18 -18
  113. package/libs/CameraMovementPlugin/CameraMovementPlugin.js +15 -24
  114. package/libs/ModelChassisCompassPlugin/Plugin.js +5 -14
  115. package/libs/ModelEntryDoorGuidePlugin/Plugin.js +8 -17
  116. package/libs/ModelTVVideoPlugin/Plugin.js +3 -12
  117. package/libs/PanoCompassPlugin/controller.js +56 -73
  118. package/libs/PanoCompassPlugin/index.d.ts +1 -1
  119. package/libs/PanoRulerPlugin/Plugin.js +3 -12
  120. package/libs/PanoRulerProPlugin/Controller.js +29 -42
  121. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +29 -42
  122. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +43 -60
  123. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +58 -79
  124. package/libs/floorplan/utils/correctFiveState.js +20 -31
  125. package/libs/floorplan/utils/formatData.js +28 -43
  126. package/libs/shared-utils/five/changeMode.js +28 -39
  127. package/libs/shared-utils/three/loadFbxObj.js +9 -20
  128. package/libs/shared-utils/three/loadTexture.js +6 -17
  129. package/libs/shared-utils/to.js +10 -21
  130. package/package.json +14 -14
@@ -1,12 +1,3 @@
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
- };
10
1
  import { Five } from '@realsee/five';
11
2
  import * as TWEEN from '@tweenjs/tween.js';
12
3
  import { tweenProgress } from '../shared-utils/animationFrame/tween';
@@ -38,21 +29,21 @@ const getLongitudeParams = (from, to, rotation) => {
38
29
  */
39
30
  export const CameraMovementPlugin = (five) => {
40
31
  const state = {};
41
- const move = (args, duration, opts = { preload: true }) => __awaiter(void 0, void 0, void 0, function* () {
32
+ const move = async (args, duration, opts = { preload: true }) => {
42
33
  if (state.interruptCallback) {
43
34
  state.interruptCallback(false);
44
35
  }
45
36
  if (opts.asyncStartCallback) {
46
- yield opts.asyncStartCallback();
37
+ await opts.asyncStartCallback();
47
38
  }
48
39
  if (args.mode && args.mode !== five.currentMode) {
49
- yield five.changeMode(args.mode);
40
+ await five.changeMode(args.mode);
50
41
  }
51
42
  if (opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex) {
52
- yield five.preloadPano(args.panoIndex);
43
+ await five.preloadPano(args.panoIndex);
53
44
  }
54
45
  if (opts.asyncEndCallback) {
55
- yield opts.asyncEndCallback();
46
+ await opts.asyncEndCallback();
56
47
  }
57
48
  if (args.panoIndex === undefined &&
58
49
  args.fov === undefined &&
@@ -60,7 +51,7 @@ export const CameraMovementPlugin = (five) => {
60
51
  args.longitude === undefined) {
61
52
  return true;
62
53
  }
63
- return yield new Promise((resolve, reject) => {
54
+ return await new Promise((resolve, reject) => {
64
55
  const panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
65
56
  if (panoIndex !== undefined) {
66
57
  five.moveToPano(panoIndex, Object.assign({
@@ -73,7 +64,7 @@ export const CameraMovementPlugin = (five) => {
73
64
  reject(false);
74
65
  }
75
66
  });
76
- });
67
+ };
77
68
  const getAnimeParams = (args) => {
78
69
  const currentFiveState = five.state;
79
70
  // latitude
@@ -89,20 +80,20 @@ export const CameraMovementPlugin = (five) => {
89
80
  to: { latitude: toLatitude, longitude: toLongitude, fov: toFov },
90
81
  };
91
82
  };
92
- const rotate = (args, duration, opts = {}) => __awaiter(void 0, void 0, void 0, function* () {
83
+ const rotate = async (args, duration, opts = {}) => {
93
84
  if (state.interruptCallback) {
94
85
  state.interruptCallback(false);
95
86
  }
96
87
  if (opts.asyncStartCallback) {
97
- yield opts.asyncStartCallback();
88
+ await opts.asyncStartCallback();
98
89
  }
99
90
  if (five.currentMode !== Five.Mode.Panorama) {
100
- yield five.changeMode(Five.Mode.Panorama);
91
+ await five.changeMode(Five.Mode.Panorama);
101
92
  }
102
93
  if (args.panoIndex !== undefined && args.panoIndex !== five.panoIndex) {
103
94
  if (opts.preload)
104
- yield five.preloadPano(args.panoIndex);
105
- yield new Promise((resolve, reject) => {
95
+ await five.preloadPano(args.panoIndex);
96
+ await new Promise((resolve, reject) => {
106
97
  if (!args.panoIndex) {
107
98
  resolve(true);
108
99
  return;
@@ -114,10 +105,10 @@ export const CameraMovementPlugin = (five) => {
114
105
  });
115
106
  }
116
107
  if (opts.asyncEndCallback) {
117
- yield opts.asyncEndCallback();
108
+ await opts.asyncEndCallback();
118
109
  }
119
110
  const { from, to } = getAnimeParams(args);
120
- return yield new Promise((resolve) => {
111
+ return await new Promise((resolve) => {
121
112
  const onUpdate = ({ progress }) => {
122
113
  const state = {};
123
114
  state.longitude = progressNumber(from.longitude, to.longitude, progress);
@@ -159,7 +150,7 @@ export const CameraMovementPlugin = (five) => {
159
150
  state.interruptCallback(true);
160
151
  }, duration);
161
152
  });
162
- });
153
+ };
163
154
  return {
164
155
  move,
165
156
  rotate,
@@ -1,12 +1,3 @@
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
- };
10
1
  import * as THREE from 'three';
11
2
  import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader';
12
3
  import object3d2LocalMatrix from '../shared-utils/object3d2LocalMatrix';
@@ -20,10 +11,10 @@ export const ModelChassisCompassPlugin = (five, params) => {
20
11
  const defaultNorthRad = (_a = params.north_rad) !== null && _a !== void 0 ? _a : undefined;
21
12
  // 局部状态
22
13
  const state = {};
23
- const load = (data) => __awaiter(void 0, void 0, void 0, function* () {
24
- var _b;
14
+ const load = async (data) => {
15
+ var _a;
25
16
  const fbxUrl = (data === null || data === void 0 ? void 0 : data.fbx_url) || defaultFbxUrl;
26
- const northRad = (_b = data === null || data === void 0 ? void 0 : data.north_rad) !== null && _b !== void 0 ? _b : defaultNorthRad;
17
+ const northRad = (_a = data === null || data === void 0 ? void 0 : data.north_rad) !== null && _a !== void 0 ? _a : defaultNorthRad;
27
18
  if (typeof northRad !== 'number') {
28
19
  throw new Error('"northRad"配置参数缺失:未配置指南针指向!');
29
20
  }
@@ -32,7 +23,7 @@ export const ModelChassisCompassPlugin = (five, params) => {
32
23
  const zOffset = bounding.max.z - bounding.min.z;
33
24
  const maxOffset = Math.max(xOffset, zOffset);
34
25
  const fbxLoader = new FBXLoader();
35
- const object = yield fbxLoader.loadAsync(fbxUrl);
26
+ const object = await fbxLoader.loadAsync(fbxUrl);
36
27
  transfromToMeshBasicMaterial(object, {
37
28
  transparent: true,
38
29
  side: THREE.DoubleSide,
@@ -46,7 +37,7 @@ export const ModelChassisCompassPlugin = (five, params) => {
46
37
  object3d2LocalMatrix(object, { position, rotation, scale });
47
38
  state.object = object;
48
39
  return true;
49
- });
40
+ };
50
41
  const onCameraUpdate = ({ latitude }) => {
51
42
  if (!state.object)
52
43
  return;
@@ -1,12 +1,3 @@
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
- };
10
1
  import { AnimationMixer, MeshBasicMaterial } from 'three';
11
2
  import * as THREE from 'three';
12
3
  import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader';
@@ -25,25 +16,25 @@ export const ModelEntryDoorGuidePlugin = (five, params) => {
25
16
  const defaultRad = (_c = params.rad) !== null && _c !== void 0 ? _c : undefined;
26
17
  const defaultFbxUrl = params.fbx_url || '//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx';
27
18
  const mixers = [];
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;
19
+ const load = async (data) => {
20
+ var _a, _b, _c, _d, _e, _f, _g;
21
+ const position = (_a = data === null || data === void 0 ? void 0 : data.position) !== null && _a !== void 0 ? _a : defaultModelPosition;
31
22
  if (!position)
32
23
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): position is undefined`);
33
24
  const modelPosition = transformPositionToVector3(position);
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
+ const rad = (_b = data === null || data === void 0 ? void 0 : data.rad) !== null && _b !== void 0 ? _b : defaultRad;
26
+ const fbxUrl = (_c = data === null || data === void 0 ? void 0 : data.fbx_url) !== null && _c !== void 0 ? _c : defaultFbxUrl;
36
27
  state.rad = rad;
37
28
  if (rad === undefined)
38
29
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): rad is ${rad}`);
39
30
  // 加载模型
40
- const object = yield new FBXLoader().loadAsync(fbxUrl);
31
+ const object = await new FBXLoader().loadAsync(fbxUrl);
41
32
  // 设置位置
42
33
  object.position.copy(modelPosition);
43
34
  object.rotation.z = rad;
44
35
  object.scale.set(0.8, 0.8, 0.8);
45
36
  transfromToMeshBasicMaterial(object, { transparent: true, side: THREE.DoubleSide });
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();
37
+ const textMesh = (_g = (_f = (_e = (_d = object.children) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.children) === null || _f === void 0 ? void 0 : _f[3]) === null || _g === void 0 ? void 0 : _g.clone();
47
38
  if (!textMesh)
48
39
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): textMesh is ${textMesh}`);
49
40
  textMesh.material = new MeshBasicMaterial({ transparent: true, map: createCanvasTextTexture('入户门') });
@@ -51,7 +42,7 @@ export const ModelEntryDoorGuidePlugin = (five, params) => {
51
42
  object.children[0].add(textMesh);
52
43
  state.object = object;
53
44
  return true;
54
- });
45
+ };
55
46
  const initAnimation = () => {
56
47
  if (state.animation)
57
48
  return;
@@ -1,12 +1,3 @@
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
- };
10
1
  import * as THREE from 'three';
11
2
  import { parseModelTVVideoPoints } from "./utils/parseData";
12
3
  export const ModelTVVideoPlugin = (five, { videoElement }) => {
@@ -161,7 +152,7 @@ export const ModelTVVideoPlugin = (five, { videoElement }) => {
161
152
  xhr.send();
162
153
  });
163
154
  };
164
- const load = (data, videoElement) => __awaiter(void 0, void 0, void 0, function* () {
155
+ const load = async (data, videoElement) => {
165
156
  const { video_src, video_poster_src, points } = data;
166
157
  state.videoSource = video_src;
167
158
  // TODO 存疑,先处理多一次遍历 o(2n)
@@ -171,11 +162,11 @@ export const ModelTVVideoPlugin = (five, { videoElement }) => {
171
162
  if (videoElement) {
172
163
  state.videoElement = videoElement;
173
164
  }
174
- state.videoTexture = yield getVideoTexture(state.videoSource, state.videoElement);
165
+ state.videoTexture = await getVideoTexture(state.videoSource, state.videoElement);
175
166
  state.enabled = !!data.enable;
176
167
  if (state.enabled)
177
168
  enable();
178
- });
169
+ };
179
170
  const dispose = () => {
180
171
  disable();
181
172
  state.videoTexture = undefined;
@@ -1,12 +1,3 @@
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
- };
10
1
  import * as THREE from 'three';
11
2
  import { Five } from '@realsee/five';
12
3
  import * as BasePlugin from '../base/BasePluginWithData';
@@ -379,19 +370,17 @@ export class PanoCompassController extends BasePlugin.Controller {
379
370
  this.init();
380
371
  }
381
372
  }
382
- load(data, state, userAction = true) {
383
- return __awaiter(this, void 0, void 0, function* () {
384
- const nextData = yield this.formatData(data);
385
- if (JSON.stringify(this.data) !== JSON.stringify(nextData)) {
386
- this.hooks.emit('dataChange', nextData, this.data);
387
- this.data = Object.assign({}, nextData);
388
- this.init();
389
- if (state) {
390
- this.setState(state, { userAction });
391
- }
392
- this.hooks.emit('dataLoaded', this.data);
373
+ async load(data, state, userAction = true) {
374
+ const nextData = await this.formatData(data);
375
+ if (JSON.stringify(this.data) !== JSON.stringify(nextData)) {
376
+ this.hooks.emit('dataChange', nextData, this.data);
377
+ this.data = Object.assign({}, nextData);
378
+ this.init();
379
+ if (state) {
380
+ this.setState(state, { userAction });
393
381
  }
394
- });
382
+ this.hooks.emit('dataLoaded', this.data);
383
+ }
395
384
  }
396
385
  formatData(serverData) {
397
386
  if (serverData.version && serverData.data) {
@@ -405,64 +394,58 @@ export class PanoCompassController extends BasePlugin.Controller {
405
394
  * 初始化
406
395
  * @todo 逻辑需要细分
407
396
  */
408
- init() {
397
+ async init() {
409
398
  var _a, _b, _c, _d;
410
- return __awaiter(this, void 0, void 0, function* () {
411
- const northRad = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.north_rad) !== null && _b !== void 0 ? _b : null;
412
- this._clearCompassIfNeed();
413
- if (northRad !== null) {
414
- this.compassMesh = yield this.loadCompassMesh();
415
- this.compassMesh.rotateX(-Math.PI / 2);
416
- this.compassMesh.rotateZ(northRad - Math.PI / 2);
417
- this.group.add(this.compassMesh);
418
- }
419
- const entrance = (_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c.entrance) !== null && _d !== void 0 ? _d : null;
420
- this._clearEntryDoorIfNeed();
421
- if (entrance !== null) {
422
- this.entryDoorMesh = yield this.loadEntryDoorMesh();
423
- this.roomInfoWrapperInstance = this.loadRoomInfo();
424
- this.roomInfoInstance = getRoomInfoInstance();
425
- this.entryDoorMesh.rotateX(-Math.PI / 2);
426
- if (this.roomInfoWrapperInstance) {
427
- this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
428
- }
429
- this.group.add(this.entryDoorMesh);
399
+ const northRad = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.north_rad) !== null && _b !== void 0 ? _b : null;
400
+ this._clearCompassIfNeed();
401
+ if (northRad !== null) {
402
+ this.compassMesh = await this.loadCompassMesh();
403
+ this.compassMesh.rotateX(-Math.PI / 2);
404
+ this.compassMesh.rotateZ(northRad - Math.PI / 2);
405
+ this.group.add(this.compassMesh);
406
+ }
407
+ const entrance = (_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c.entrance) !== null && _d !== void 0 ? _d : null;
408
+ this._clearEntryDoorIfNeed();
409
+ if (entrance !== null) {
410
+ this.entryDoorMesh = await this.loadEntryDoorMesh();
411
+ this.roomInfoWrapperInstance = this.loadRoomInfo();
412
+ this.roomInfoInstance = getRoomInfoInstance();
413
+ this.entryDoorMesh.rotateX(-Math.PI / 2);
414
+ if (this.roomInfoWrapperInstance) {
415
+ this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
430
416
  }
431
- this.onFivePanoArrived(this.five.panoIndex || 0);
432
- this.five.needsRender = true;
433
- });
417
+ this.group.add(this.entryDoorMesh);
418
+ }
419
+ this.onFivePanoArrived(this.five.panoIndex || 0);
420
+ this.five.needsRender = true;
434
421
  }
435
- loadCompassMesh() {
436
- return __awaiter(this, void 0, void 0, function* () {
437
- const compassImageUrl = this.state.config.compassImageUrl;
438
- const compassTexture = yield loadTexture(compassImageUrl);
439
- const compassGeometry = new THREE.CircleGeometry(0.7, 32);
440
- const compassMaterial = new THREE.MeshBasicMaterial({
441
- map: compassTexture,
442
- transparent: true,
443
- opacity: 0,
444
- depthTest: false,
445
- });
446
- const compassMesh = new THREE.Mesh(compassGeometry, compassMaterial);
447
- compassMesh.name = 'pano-compass-mesh';
448
- return compassMesh;
422
+ async loadCompassMesh() {
423
+ const compassImageUrl = this.state.config.compassImageUrl;
424
+ const compassTexture = await loadTexture(compassImageUrl);
425
+ const compassGeometry = new THREE.CircleGeometry(0.7, 32);
426
+ const compassMaterial = new THREE.MeshBasicMaterial({
427
+ map: compassTexture,
428
+ transparent: true,
429
+ opacity: 0,
430
+ depthTest: false,
449
431
  });
432
+ const compassMesh = new THREE.Mesh(compassGeometry, compassMaterial);
433
+ compassMesh.name = 'pano-compass-mesh';
434
+ return compassMesh;
450
435
  }
451
- loadEntryDoorMesh() {
452
- return __awaiter(this, void 0, void 0, function* () {
453
- const entryDoorImageUrl = this.state.config.entryDoorImageUrl;
454
- const entryDoorTexture = yield loadTexture(entryDoorImageUrl);
455
- const entryDoorGeometry = new THREE.PlaneGeometry(0.2, 0.16);
456
- const entryDoorMaterial = new THREE.MeshBasicMaterial({
457
- map: entryDoorTexture,
458
- transparent: true,
459
- opacity: 0.8,
460
- depthTest: false,
461
- });
462
- const entryDoorMesh = new THREE.Mesh(entryDoorGeometry, entryDoorMaterial);
463
- entryDoorMesh.name = 'pano-compass-entry-door';
464
- return entryDoorMesh;
436
+ async loadEntryDoorMesh() {
437
+ const entryDoorImageUrl = this.state.config.entryDoorImageUrl;
438
+ const entryDoorTexture = await loadTexture(entryDoorImageUrl);
439
+ const entryDoorGeometry = new THREE.PlaneGeometry(0.2, 0.16);
440
+ const entryDoorMaterial = new THREE.MeshBasicMaterial({
441
+ map: entryDoorTexture,
442
+ transparent: true,
443
+ opacity: 0.8,
444
+ depthTest: false,
465
445
  });
446
+ const entryDoorMesh = new THREE.Mesh(entryDoorGeometry, entryDoorMaterial);
447
+ entryDoorMesh.name = 'pano-compass-entry-door';
448
+ return entryDoorMesh;
466
449
  }
467
450
  loadRoomInfo() {
468
451
  const points = [
@@ -4,4 +4,4 @@ import type { PanoCompassPluginParameterType } from './typings';
4
4
  export declare type PanoCompassPluginExportType = PanoCompassController;
5
5
  export declare const PanoCompassPlugin: FivePlugin<PanoCompassPluginParameterType, PanoCompassPluginExportType>;
6
6
  export default PanoCompassPlugin;
7
- export type { PanoCompassPluginParameterType } from './typings';
7
+ export type { PanoCompassPluginParameterType, PanoCompassPluginData } from './typings';
@@ -1,12 +1,3 @@
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
- };
10
1
  import { Five } from '@realsee/five';
11
2
  import { Raycaster, Vector3 } from 'three';
12
3
  import { intersectionOfLine } from '../shared-utils/math/planimetry';
@@ -171,7 +162,7 @@ export const PanoRulerPlugin = (five, params) => {
171
162
  freshRule();
172
163
  return true;
173
164
  };
174
- const load = (_roomInfo, _roomRules, options) => __awaiter(void 0, void 0, void 0, function* () {
165
+ const load = async (_roomInfo, _roomRules, options) => {
175
166
  const roomInfo = _roomInfo || params.roomInfo;
176
167
  const roomRules = _roomRules || params.roomRules;
177
168
  if (!roomInfo || !roomRules) {
@@ -183,9 +174,9 @@ export const PanoRulerPlugin = (five, params) => {
183
174
  return _load(roomInfo, roomRules);
184
175
  }
185
176
  else {
186
- return yield new Promise((resolve) => five.once('modelLoaded', () => resolve(_load(roomInfo, roomRules))));
177
+ return await new Promise((resolve) => five.once('modelLoaded', () => resolve(_load(roomInfo, roomRules))));
187
178
  }
188
- });
179
+ };
189
180
  if (params.roomInfo && params.roomRules) {
190
181
  load(params.roomInfo, params.roomRules);
191
182
  }
@@ -1,12 +1,3 @@
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
- };
10
1
  import RulerItems from './RulerItems';
11
2
  export default class Controller {
12
3
  constructor(five, params) {
@@ -59,22 +50,20 @@ export default class Controller {
59
50
  if ((_a = params.options) === null || _a === void 0 ? void 0 : _a.className)
60
51
  this.container.classList.add((_b = params.options) === null || _b === void 0 ? void 0 : _b.className);
61
52
  }
62
- this.five.once('modelLoaded', () => __awaiter(this, void 0, void 0, function* () {
63
- var _c, _d;
64
- (_d = (_c = this.five.getElement()) === null || _c === void 0 ? void 0 : _c.parentNode) === null || _d === void 0 ? void 0 : _d.append(this.container);
65
- }));
53
+ this.five.once('modelLoaded', async () => {
54
+ var _a, _b;
55
+ (_b = (_a = this.five.getElement()) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.append(this.container);
56
+ });
66
57
  this.five.once('dispose', () => this.dispose());
67
58
  }
68
- load(serverData) {
69
- return __awaiter(this, void 0, void 0, function* () {
70
- if (!this.five.work)
71
- return;
72
- const data = serverData.data;
73
- if (!data)
74
- throw new Error('标尺数据依赖不齐全!');
75
- this.panoRulerProData = data;
76
- this.state.loaded = true;
77
- });
59
+ async load(serverData) {
60
+ if (!this.five.work)
61
+ return;
62
+ const data = serverData.data;
63
+ if (!data)
64
+ throw new Error('标尺数据依赖不齐全!');
65
+ this.panoRulerProData = data;
66
+ this.state.loaded = true;
78
67
  }
79
68
  enable() {
80
69
  if (!this.state.loaded)
@@ -92,26 +81,24 @@ export default class Controller {
92
81
  this.render();
93
82
  return true;
94
83
  }
95
- render() {
84
+ async render() {
96
85
  var _a;
97
- return __awaiter(this, void 0, void 0, function* () {
98
- if (this.state.enabled) {
99
- if (!this.panoRulerProData || !this.container)
100
- return;
101
- this.rulerItems = new RulerItems({
102
- target: this.container,
103
- props: {
104
- five: this.five,
105
- rulerDatas: this.panoRulerProData,
106
- options: this.state.options,
107
- },
108
- });
109
- }
110
- else {
111
- (_a = this.rulerItems) === null || _a === void 0 ? void 0 : _a.$destroy();
112
- this.rulerItems = undefined;
113
- }
114
- });
86
+ if (this.state.enabled) {
87
+ if (!this.panoRulerProData || !this.container)
88
+ return;
89
+ this.rulerItems = new RulerItems({
90
+ target: this.container,
91
+ props: {
92
+ five: this.five,
93
+ rulerDatas: this.panoRulerProData,
94
+ options: this.state.options,
95
+ },
96
+ });
97
+ }
98
+ else {
99
+ (_a = this.rulerItems) === null || _a === void 0 ? void 0 : _a.$destroy();
100
+ this.rulerItems = undefined;
101
+ }
115
102
  }
116
103
  dispose() {
117
104
  if (this.container) {