@realsee/dnalogel 2.0.0-alpha.35 → 2.0.0-alpha.36

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 (211) hide show
  1. package/dist/ItemLabelPlugin/index.js +21 -41
  2. package/dist/ModelItemLabelPlugin/index.js +16 -36
  3. package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +1 -1
  4. package/dist/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +0 -4
  5. package/dist/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +0 -3
  6. package/dist/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
  7. package/dist/PanoMeasurePlugin/Modules/UIController/{NewMainBtnController.d.ts → mobileMainBtnController.d.ts} +1 -1
  8. package/dist/PanoMeasurePlugin/Modules/UIController/style.d.ts +0 -3
  9. package/dist/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +1 -1
  10. package/dist/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +2 -0
  11. package/dist/PanoMeasurePlugin/index.js +298 -331
  12. package/dist/PanoMeasurePlugin/typings/data.d.ts +5 -0
  13. package/dist/PanoMeasurePlugin/utils/mouseGroup.d.ts +6 -1
  14. package/dist/base/BasePlugin.d.ts +100 -0
  15. package/dist/base/BasePluginWithData.d.ts +34 -0
  16. package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +70 -78
  17. package/dist/floorplan/ModelFloorplanPlugin/index.d.ts +5 -7
  18. package/dist/floorplan/ModelFloorplanPlugin/index.js +1059 -569
  19. package/dist/floorplan/ModelFloorplanPlugin/typing.d.ts +107 -0
  20. package/dist/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +23 -14
  21. package/dist/floorplan/PanoFloorplanRadarPlugin/index.d.ts +5 -6
  22. package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +489 -129
  23. package/dist/floorplan/PanoFloorplanRadarPlugin/typing.d.ts +52 -0
  24. package/dist/floorplan/TopviewFloorplanPlugin/Controller.d.ts +50 -58
  25. package/dist/floorplan/TopviewFloorplanPlugin/index.d.ts +5 -3
  26. package/dist/floorplan/TopviewFloorplanPlugin/index.js +1031 -443
  27. package/dist/floorplan/TopviewFloorplanPlugin/typing.d.ts +86 -0
  28. package/{libs/floorplan/ModelFloorplanPlugin → dist/floorplan}/utils/constant.d.ts +10 -3
  29. package/{libs/floorplan/ModelFloorplanPlugin → dist/floorplan}/utils/correctFiveState.d.ts +2 -1
  30. package/dist/index.es.js +2184 -1411
  31. package/dist/index.js +2188 -1415
  32. package/dist/index.umd.js +2142 -1369
  33. package/dist/shared-utils/five/changeMode.d.ts +4 -1
  34. package/dist/shared-utils/getPxmm.d.ts +8 -0
  35. package/docs/assets/search.js +1 -1
  36. package/docs/classes/Magnifier.html +4 -4
  37. package/docs/classes/ModelRoomLabelController.html +4 -4
  38. package/docs/enums/CameraMovementEffect.html +2 -2
  39. package/docs/enums/DIRECTION.html +1 -1
  40. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  41. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  42. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  43. package/docs/enums/Rotation.html +2 -2
  44. package/docs/index.html +2 -2
  45. package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
  46. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  47. package/docs/interfaces/FloorplanBounding.html +4 -4
  48. package/docs/interfaces/FloorplanData.html +2 -2
  49. package/docs/interfaces/FloorplanEntrance.html +7 -7
  50. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  51. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  52. package/docs/interfaces/FloorplanFloorData.html +2 -2
  53. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  54. package/docs/interfaces/FloorplanObserver.html +2 -2
  55. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  56. package/docs/interfaces/FloorplanPosition.html +2 -2
  57. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  58. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  59. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  60. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  61. package/docs/interfaces/FloorplanServerData.html +2 -2
  62. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  63. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  64. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  65. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  66. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  67. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  68. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  69. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  70. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  71. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  72. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  73. package/docs/interfaces/LineJson.html +1 -1
  74. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  75. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  76. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  77. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  78. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  79. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  80. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  81. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  82. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  83. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  84. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  85. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  86. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  87. package/docs/interfaces/OpenParameter.html +2 -2
  88. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  89. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  90. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  91. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  92. package/docs/interfaces/PanoMeasureParameterType.html +1 -1
  93. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  94. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  95. package/docs/interfaces/PanoRulerPluginParameterType.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 +17 -27
  113. package/libs/ItemLabelPlugin/ItemLabelComponent.js +21 -41
  114. package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +16 -36
  115. package/libs/PanoMeasurePlugin/Controller/index.js +4 -2
  116. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +1 -1
  117. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.js +1 -1
  118. package/libs/PanoMeasurePlugin/Modules/GuideController.js +2 -2
  119. package/libs/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +0 -4
  120. package/libs/PanoMeasurePlugin/Modules/UIController/HTML.js +66 -55
  121. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +0 -3
  122. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +51 -73
  123. package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +7 -4
  124. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +10 -12
  125. package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
  126. package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.js +2 -2
  127. package/libs/PanoMeasurePlugin/Modules/UIController/{NewMainBtnController.d.ts → mobileMainBtnController.d.ts} +1 -1
  128. package/libs/PanoMeasurePlugin/Modules/UIController/{NewMainBtnController.js → mobileMainBtnController.js} +4 -4
  129. package/libs/PanoMeasurePlugin/Modules/UIController/style.d.ts +0 -3
  130. package/libs/PanoMeasurePlugin/Modules/UIController/style.js +7 -24
  131. package/libs/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +1 -1
  132. package/libs/PanoMeasurePlugin/Modules/rangePiece/html.js +1 -1
  133. package/libs/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +2 -0
  134. package/libs/PanoMeasurePlugin/Modules/rangePiece/index.js +1 -2
  135. package/libs/PanoMeasurePlugin/typings/data.d.ts +5 -0
  136. package/libs/PanoMeasurePlugin/utils/mouseGroup.d.ts +6 -1
  137. package/libs/PanoMeasurePlugin/utils/mouseGroup.js +55 -7
  138. package/libs/base/BasePlugin.d.ts +100 -0
  139. package/libs/base/BasePlugin.js +31 -0
  140. package/libs/base/BasePluginWithData.d.ts +34 -0
  141. package/libs/base/BasePluginWithData.js +4 -0
  142. package/libs/floorplan/Components/Compass.js +11 -11
  143. package/libs/floorplan/Components/CurrentFloor.js +24 -11
  144. package/libs/floorplan/Components/Main.js +21 -15
  145. package/libs/floorplan/Components/RoomHighlight/Room.js +44 -5
  146. package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +29 -12
  147. package/libs/floorplan/Components/RoomLabels/RoomLabel.js +164 -15
  148. package/libs/floorplan/Components/RoomLabels/RoomLabels.js +68 -24
  149. package/libs/floorplan/Components/RoomMaterials/RoomMaterial_1.js +1 -0
  150. package/libs/floorplan/Components/RoomMaterials/RoomMaterial_2.js +11 -9
  151. package/libs/floorplan/Components/RuleLabels/RuleItem.js +2 -2
  152. package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +70 -78
  153. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +434 -274
  154. package/libs/floorplan/ModelFloorplanPlugin/index.d.ts +5 -7
  155. package/libs/floorplan/ModelFloorplanPlugin/index.js +2 -2
  156. package/libs/floorplan/ModelFloorplanPlugin/typing.d.ts +107 -0
  157. package/libs/floorplan/ModelFloorplanPlugin/{typings/events.type.js → typing.js} +0 -0
  158. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Camera.js +5 -5
  159. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Main.js +114 -53
  160. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +23 -14
  161. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +162 -52
  162. package/libs/floorplan/PanoFloorplanRadarPlugin/index.d.ts +5 -6
  163. package/libs/floorplan/PanoFloorplanRadarPlugin/index.js +2 -2
  164. package/libs/floorplan/PanoFloorplanRadarPlugin/typing.d.ts +52 -0
  165. package/libs/floorplan/PanoFloorplanRadarPlugin/typing.js +1 -0
  166. package/libs/floorplan/TopviewFloorplanPlugin/Controller.d.ts +50 -58
  167. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +320 -174
  168. package/libs/floorplan/TopviewFloorplanPlugin/index.d.ts +5 -3
  169. package/libs/floorplan/TopviewFloorplanPlugin/index.js +2 -2
  170. package/libs/floorplan/TopviewFloorplanPlugin/style.js +1 -1
  171. package/libs/floorplan/TopviewFloorplanPlugin/typing.d.ts +86 -0
  172. package/libs/floorplan/TopviewFloorplanPlugin/typing.js +1 -0
  173. package/{dist/floorplan/ModelFloorplanPlugin → libs/floorplan}/utils/constant.d.ts +10 -3
  174. package/libs/floorplan/{ModelFloorplanPlugin/utils → utils}/constant.js +9 -2
  175. package/{dist/floorplan/ModelFloorplanPlugin → libs/floorplan}/utils/correctFiveState.d.ts +2 -1
  176. package/libs/floorplan/{ModelFloorplanPlugin/utils → utils}/correctFiveState.js +16 -16
  177. package/libs/shared-utils/five/changeMode.d.ts +4 -1
  178. package/libs/shared-utils/five/changeMode.js +34 -13
  179. package/libs/shared-utils/getPxmm.d.ts +8 -0
  180. package/libs/shared-utils/getPxmm.js +25 -20
  181. package/package.json +2 -2
  182. package/dist/floorplan/ModelFloorplanPlugin/typings/events.type.d.ts +0 -23
  183. package/docs/classes/PanoFloorplanRadarPluginController.html +0 -3
  184. package/docs/enums/ModelFloorplanErrorType.html +0 -1
  185. package/docs/interfaces/ModelFloorplanParameterType.html +0 -1
  186. package/docs/interfaces/ModelFloorplanViewEvent.html +0 -5
  187. package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +0 -1
  188. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +0 -19
  189. package/libs/ModelSimulationPlugin/index.d.ts +0 -33
  190. package/libs/ModelSimulationPlugin/index.js +0 -166
  191. package/libs/ModelSimulationPlugin/shaders/fragment.d.ts +0 -2
  192. package/libs/ModelSimulationPlugin/shaders/fragment.js +0 -96
  193. package/libs/ModelSimulationPlugin/shaders/vertex.d.ts +0 -2
  194. package/libs/ModelSimulationPlugin/shaders/vertex.js +0 -23
  195. package/libs/floorplan/ModelFloorplanPlugin/Assets/compass.d.ts +0 -1
  196. package/libs/floorplan/ModelFloorplanPlugin/Assets/compass.js +0 -1
  197. package/libs/floorplan/ModelFloorplanPlugin/Components/Camera.js +0 -120
  198. package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +0 -106
  199. package/libs/floorplan/ModelFloorplanPlugin/Components/CurrentFloor/CurrentFloor.js +0 -463
  200. package/libs/floorplan/ModelFloorplanPlugin/Components/Main.js +0 -375
  201. package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +0 -171
  202. package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabels.js +0 -265
  203. package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleItem.js +0 -301
  204. package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleLabels.js +0 -219
  205. package/libs/floorplan/ModelFloorplanPlugin/typings/events.type.d.ts +0 -23
  206. package/libs/shared-utils/five/useFivePlugin.d.ts +0 -1
  207. package/libs/shared-utils/five/useFivePlugin.js +0 -8
  208. package/libs/shared-utils/useDebounce.d.ts +0 -8
  209. package/libs/shared-utils/useDebounce.js +0 -22
  210. package/libs/shared-utils/useThrottle.d.ts +0 -8
  211. package/libs/shared-utils/useThrottle.js +0 -25
@@ -1,48 +1,61 @@
1
1
  import Main from './Components/Main';
2
+ import equal from '../../shared-utils/equal';
3
+ import { CAMERA_IMAGE } from '../Assets/camera';
4
+ import * as BasePlugin from '../../base/BasePluginWithData';
2
5
  import formatData, { formatExtraObjects } from '../utils/formatData';
3
- export default class PanoFloorplanRadarPluginController {
6
+ export class Controller extends BasePlugin.Controller {
4
7
  constructor(five, params) {
5
- Object.defineProperty(this, "app", {
8
+ super(five);
9
+ // =============== public properties =================
10
+ Object.defineProperty(this, "name", {
6
11
  enumerable: true,
7
12
  configurable: true,
8
13
  writable: true,
9
- value: void 0
14
+ value: 'panoFloorplanRadarPlugin'
10
15
  });
11
- Object.defineProperty(this, "five", {
16
+ Object.defineProperty(this, "state", {
12
17
  enumerable: true,
13
18
  configurable: true,
14
19
  writable: true,
15
20
  value: void 0
16
21
  });
17
- Object.defineProperty(this, "wrapperSelector", {
22
+ // =============== protected properties =================
23
+ Object.defineProperty(this, "data", {
18
24
  enumerable: true,
19
25
  configurable: true,
20
26
  writable: true,
21
- value: ''
27
+ value: void 0
22
28
  });
23
- Object.defineProperty(this, "data", {
29
+ // =============== private properties =================
30
+ Object.defineProperty(this, "app", {
24
31
  enumerable: true,
25
32
  configurable: true,
26
33
  writable: true,
27
34
  value: void 0
28
35
  });
36
+ Object.defineProperty(this, "wrapperSelector", {
37
+ enumerable: true,
38
+ configurable: true,
39
+ writable: true,
40
+ value: ''
41
+ });
29
42
  Object.defineProperty(this, "wrapper", {
30
43
  enumerable: true,
31
44
  configurable: true,
32
45
  writable: true,
33
46
  value: null
34
47
  });
35
- Object.defineProperty(this, "extraObjects", {
48
+ Object.defineProperty(this, "disposed", {
36
49
  enumerable: true,
37
50
  configurable: true,
38
51
  writable: true,
39
- value: []
52
+ value: false
40
53
  });
41
- Object.defineProperty(this, "configs", {
54
+ Object.defineProperty(this, "extraObjects", {
42
55
  enumerable: true,
43
56
  configurable: true,
44
57
  writable: true,
45
- value: {}
58
+ value: []
46
59
  });
47
60
  Object.defineProperty(this, "dispose", {
48
61
  enumerable: true,
@@ -50,50 +63,123 @@ export default class PanoFloorplanRadarPluginController {
50
63
  writable: true,
51
64
  value: () => {
52
65
  var _a;
66
+ this.disposed = true;
53
67
  (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
68
+ this.wrapper = null;
69
+ this.wrapperSelector = '';
70
+ this.hooks.emit('dispose');
54
71
  }
55
72
  });
56
- Object.defineProperty(this, "load", {
73
+ Object.defineProperty(this, "_disable", {
57
74
  enumerable: true,
58
75
  configurable: true,
59
76
  writable: true,
60
- value: async (data) => {
61
- const copyData = JSON.parse(JSON.stringify(data));
62
- const floorplanData = await formatData(copyData);
63
- this.data = floorplanData;
64
- // const loadImage = async () => {
65
- // const floorIndex = this.five.work.observers[this.five.getCurrentState().panoIndex].floorIndex
66
- // // 当有 svgString 时,没有加载过程
67
- // if (floorplanData.outlines[floorIndex]?.svgContent) return
68
- // // 如果当前楼层图片不存在,不存在加载过程
69
- // const nowFloorImageSrc = floorplanData.outlines[floorIndex]?.url
70
- // if (!nowFloorImageSrc) return
71
- // // 图片加载完成时再 render
72
- // await new Promise<void>((resolve) => {
73
- // const nowFloorImage = new Image()
74
- // nowFloorImage.src = nowFloorImageSrc
75
- // nowFloorImage.onload = () => resolve()
76
- // })
77
- // }
78
- // await loadImage()
79
- this.render();
77
+ value: (options) => {
78
+ var _a;
79
+ const { userAction } = options;
80
+ (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
81
+ this.app = undefined;
82
+ this.hooks.emit('disable', { userAction });
80
83
  }
81
84
  });
82
85
  this.five = five;
83
- (params === null || params === void 0 ? void 0 : params.configs) && Object.assign(this.configs, params.configs);
86
+ // =============== init State ===============
87
+ const baseConfig = {
88
+ hoverEnable: false,
89
+ cameraImageUrl: CAMERA_IMAGE,
90
+ };
91
+ const paramsConfig = (params === null || params === void 0 ? void 0 : params.configs) ? params.configs : {};
92
+ const config = Object.assign(Object.assign({}, baseConfig), paramsConfig);
93
+ this.state = { enabled: true, visible: true, config };
94
+ // =============== init wrapper ===============
95
+ if (params === null || params === void 0 ? void 0 : params.wrapper)
96
+ console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
84
97
  if (typeof (params === null || params === void 0 ? void 0 : params.wrapper) === 'string')
85
98
  this.wrapperSelector = params.wrapper;
86
99
  else if ((params === null || params === void 0 ? void 0 : params.wrapper) instanceof Element)
87
100
  this.wrapper = params.wrapper;
101
+ // =============== init Listener ===============
88
102
  five.once('dispose', this.dispose);
89
103
  }
104
+ async load(serverData, state, userAction = true) {
105
+ // const loadImage = async () => {
106
+ // const floorIndex = this.five.work.observers[this.five.getCurrentState().panoIndex].floorIndex
107
+ // // 当有 svgString 时,没有加载过程
108
+ // if (floorplanData.outlines[floorIndex]?.svgContent) return
109
+ // // 如果当前楼层图片不存在,不存在加载过程
110
+ // const nowFloorImageSrc = floorplanData.outlines[floorIndex]?.url
111
+ // if (!nowFloorImageSrc) return
112
+ // // 图片加载完成时再 render
113
+ // await new Promise<void>((resolve) => {
114
+ // const nowFloorImage = new Image()
115
+ // nowFloorImage.src = nowFloorImageSrc
116
+ // nowFloorImage.onload = () => resolve()
117
+ // })
118
+ // }
119
+ // await loadImage()
120
+ function isPluginServerData(serverData) {
121
+ return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
122
+ }
123
+ const copyData = JSON.parse(JSON.stringify(serverData));
124
+ const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
125
+ const prevData = this.data;
126
+ this.data = await formatData(_serverData);
127
+ this.hooks.emit('dataLoaded', this.data);
128
+ this.hooks.emit('dataChange', this.data, prevData);
129
+ if (state)
130
+ this.updateState(state, userAction);
131
+ this.render();
132
+ }
133
+ async show(options = {}) {
134
+ // 已经展示完成了,不做任何操作
135
+ if (this.state.visible)
136
+ return;
137
+ const userAction = options.userAction !== undefined ? options.userAction : true;
138
+ this.updateState({ visible: true }, userAction);
139
+ this._show({ userAction });
140
+ }
141
+ async hide(options = {}) {
142
+ if (!this.state.visible)
143
+ return;
144
+ const userAction = options.userAction !== undefined ? options.userAction : true;
145
+ this.updateState({ visible: false }, userAction);
146
+ this._hide({ userAction });
147
+ }
148
+ enable(options = {}) {
149
+ if (this.state.enabled)
150
+ return;
151
+ const userAction = options.userAction !== undefined ? options.userAction : true;
152
+ this.updateState({ enabled: true }, options.userAction || userAction);
153
+ this._enable({ userAction });
154
+ }
155
+ disable(options = {}) {
156
+ if (!this.state.enabled)
157
+ return;
158
+ const userAction = options.userAction !== undefined ? options.userAction : true;
159
+ this.updateState({ enabled: false }, options.userAction || userAction);
160
+ this._disable({ userAction });
161
+ }
162
+ /** 更改插件 State */
163
+ setState(state, options = {}) {
164
+ const prevState = this.state;
165
+ const userAction = options.userAction !== undefined ? options.userAction : true;
166
+ this.updateState(state, userAction);
167
+ if (state.enabled !== undefined && prevState.enabled !== state.enabled) {
168
+ const options = { userAction };
169
+ state.enabled ? this._enable(options) : this._disable(options);
170
+ }
171
+ if (state.visible !== undefined && prevState.visible !== state.visible) {
172
+ const options = { userAction };
173
+ state.visible ? this._show(options) : this._hide(options);
174
+ }
175
+ }
90
176
  /** 把插件的渲染DOM插入到对应的容器中去 */
91
177
  appendTo(wrapper) {
92
178
  this.wrapper = wrapper;
93
179
  this.render();
94
180
  }
95
- changeConfigs(configs) {
96
- Object.assign(this.configs, configs);
181
+ changeConfigs(config, userAction = true) {
182
+ this.setState({ config }, { userAction });
97
183
  this.render();
98
184
  }
99
185
  setExtraObjectsWith3DPositions(data) {
@@ -102,29 +188,53 @@ export default class PanoFloorplanRadarPluginController {
102
188
  this.extraObjects = formatExtraObjects(data, this.five, this.data);
103
189
  this.render();
104
190
  }
191
+ async formatData(serverData) {
192
+ return await formatData(serverData.data);
193
+ }
194
+ _enable(options) {
195
+ const { userAction } = options;
196
+ this.hooks.emit('enable', { userAction });
197
+ if (this.state.visible)
198
+ this._show({ userAction });
199
+ }
200
+ _show(options) {
201
+ if (this.disposed)
202
+ return;
203
+ if (!this.state.enabled)
204
+ return;
205
+ const { userAction } = options;
206
+ this.hooks.emit('show', { userAction });
207
+ this.render();
208
+ }
209
+ _hide(options) {
210
+ if (this.disposed)
211
+ return;
212
+ if (!this.state.enabled)
213
+ return;
214
+ const { userAction } = options;
215
+ this.hooks.emit('hide', { userAction });
216
+ this.render();
217
+ }
218
+ updateState(state, userAction) {
219
+ const prevState = this.state;
220
+ this.state = Object.assign(Object.assign({}, this.state), state);
221
+ if (equal(this.state, prevState, { deep: true }))
222
+ return;
223
+ this.hooks.emit('stateChange', { state: this.state, prevState, userAction });
224
+ }
105
225
  render() {
106
- var _a;
226
+ if (this.disposed)
227
+ return;
228
+ if (!this.state.enabled)
229
+ return;
107
230
  // 处理 wrapper
108
- if (!this.wrapper) {
231
+ if (!this.wrapper && this.wrapperSelector) {
109
232
  const _wrapper = document.querySelector(this.wrapperSelector);
110
233
  this.wrapper = _wrapper;
111
234
  }
112
235
  if (!this.data || !this.wrapper)
113
236
  return;
114
- const props = {
115
- five: this.five,
116
- floorplanData: this.data,
117
- extraObjects: this.extraObjects,
118
- cameraImageUrl: this.configs.cameraImageUrl,
119
- hoverEnable: (_a = this.configs.hoverEnable) !== null && _a !== void 0 ? _a : false,
120
- };
121
- if (!this.app) {
122
- this.app = new Main({
123
- target: this.wrapper,
124
- props,
125
- });
126
- return;
127
- }
128
- this.app.$set(props);
237
+ const props = Object.assign(Object.assign({}, this.state.config), { five: this.five, floorplanData: this.data, visible: this.state.visible, extraObjects: this.extraObjects });
238
+ this.app ? this.app.$set(props) : (this.app = new Main({ target: this.wrapper, props }));
129
239
  }
130
240
  }
@@ -1,8 +1,7 @@
1
+ import type { Parameters } from './typing';
1
2
  import type { FivePlugin } from '@realsee/five';
2
- import PanoFloorplanRadarPluginController from './Controller';
3
- export declare const PanoFloorplanRadarPlugin: FivePlugin<PanoFloorplanRadarPluginParameterType, PanoFloorplanRadarPluginReturnType>;
3
+ import { Controller } from './Controller';
4
+ export declare const PanoFloorplanRadarPlugin: FivePlugin<Parameters | undefined, Controller>;
5
+ export declare type PanoFloorplanRadarPluginParameterType = Parameters | undefined;
6
+ export declare type PanoFloorplanRadarPluginReturnType = InstanceType<typeof Controller>;
4
7
  export default PanoFloorplanRadarPlugin;
5
- export type { PanoFloorplanRadarPluginController };
6
- export type { PanoFloorplanRadarPluginControllerParameter } from './Controller';
7
- export declare type PanoFloorplanRadarPluginReturnType = PanoFloorplanRadarPluginController;
8
- export declare type PanoFloorplanRadarPluginParameterType = ConstructorParameters<typeof PanoFloorplanRadarPluginController>[1];
@@ -1,5 +1,5 @@
1
- import PanoFloorplanRadarPluginController from './Controller';
1
+ import { Controller } from './Controller';
2
2
  export const PanoFloorplanRadarPlugin = (five, params) => {
3
- return new PanoFloorplanRadarPluginController(five, params);
3
+ return new Controller(five, params);
4
4
  };
5
5
  export default PanoFloorplanRadarPlugin;
@@ -0,0 +1,52 @@
1
+ import type * as BasePlugin from '../../base/BasePluginWithData';
2
+ import type { FloorplanData } from '../typings/floorplanData';
3
+ import type { FloorplanServerData } from '../typings/floorplanServerData';
4
+ export interface Config {
5
+ /** 鼠标放置在分间上时,是否要自动高亮分间 */
6
+ hoverEnable: boolean;
7
+ /** 自定义「雷达」图标 */
8
+ cameraImageUrl: string;
9
+ }
10
+ export interface State extends BasePlugin.State {
11
+ visible: boolean;
12
+ config: Config;
13
+ }
14
+ export interface EventMap extends BasePlugin.EventMap<State, FloorplanData> {
15
+ /** visible 从 false 到 true 的回调
16
+ * @param event.userAction 是否是用户操作
17
+ */
18
+ show: (event: {
19
+ userAction: boolean;
20
+ }) => void;
21
+ /** visible 从 true 到 false 的回调
22
+ * @param event.userAction 是否是用户操作
23
+ */
24
+ hide: (event: {
25
+ userAction: boolean;
26
+ }) => void;
27
+ /** enabled 从 false 到 true 的回调
28
+ * @param event.userAction 是否是用户操作
29
+ */
30
+ enable: (event: {
31
+ userAction: boolean;
32
+ }) => void;
33
+ /** enabled 从 true 到 false 的回调
34
+ * @param event.userAction 是否是用户操作
35
+ */
36
+ disable: (event: {
37
+ userAction: boolean;
38
+ }) => void;
39
+ }
40
+ /** 插件初始化参数 */
41
+ export interface Parameters extends Partial<Config> {
42
+ wrapper?: string | Element;
43
+ configs?: {
44
+ hoverEnable?: boolean;
45
+ cameraImageUrl?: string;
46
+ };
47
+ }
48
+ export interface PluginServerData extends BasePlugin.ServerData {
49
+ version: number;
50
+ data: FloorplanServerData;
51
+ }
52
+ export { FloorplanData as PluginData };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,75 +1,67 @@
1
+ import type { BaseOptions } from '../../base/BasePlugin';
1
2
  import type { Five } from '@realsee/five';
2
- import type { FLOOR_PLAN_ATTACHED_TO } from '../constant';
3
3
  import type { FloorplanServerData } from '../typings/floorplanServerData';
4
- import type { FloorplanRoomItem } from '../typings/floorplanData';
5
- /** TopviewFloorplanPlugin 配置参数 */
6
- interface Configs {
7
- northDesc?: string;
8
- modelOpacity?: number;
9
- cameraImageUrl?: string;
10
- /** 是否开启高亮房间功能,默认为 false */
11
- hoverEnable?: boolean;
12
- /** 是否开启放大缩小和拖动功能,默认为 false */
13
- gestureEnable?: boolean;
14
- /** 是否展示指南针,默认为 true */
15
- compassEnable?: boolean;
16
- /** 是否展示户型图标尺,默认为 true */
17
- ruleLabelsEnable?: boolean;
18
- /** 是否展示房间标签,默认为 true */
19
- roomLabelsEnable?: boolean;
20
- /** 点击房间时,是否需要跳转到被点房间的全景态点位上,默认为 true */
21
- preventRoomClick?: boolean;
22
- /** 户型图展示时,应该对应到模型的哪个位置上,默认是 BOUNDING_CENTER */
23
- attachedTo?: FLOOR_PLAN_ATTACHED_TO;
24
- /** 用户自定义房间标间 DOM 函数 */
25
- getLabelElement?: (room: FloorplanRoomItem) => Element | null;
26
- }
27
- /** TopviewFloorplanPlugin 初始化参数 */
28
- export interface TopviewFloorplanPluginParameterType extends Configs {
29
- selector?: string | Element;
30
- scale?: number;
31
- }
32
- export declare type TopviewFloorplanPluginReturnType = TopviewFloorplanPluginController;
33
- export declare class TopviewFloorplanPluginController {
34
- size: {
35
- width: number;
36
- height: number;
37
- };
38
- visible: boolean;
39
- private pxmm;
4
+ import type { State, EventMap, Parameters, PluginData, PluginServerData } from './typing';
5
+ import * as BasePlugin from '../../base/BasePluginWithData';
6
+ export declare class Controller extends BasePlugin.Controller<State, EventMap, PluginServerData, PluginData> {
7
+ name: string;
8
+ state: State;
9
+ protected data?: PluginData;
40
10
  private app?;
41
- private five;
11
+ private selector?;
42
12
  private panoIndex;
43
13
  private floorIndex;
44
- private configs;
45
- private lastPanoramaLongitude;
46
- private selector?;
47
- private floorplanData?;
14
+ /** 户型图父容器 */
48
15
  private wrapper?;
16
+ /** 户型图主容器 */
49
17
  private container;
50
- constructor(five: Five, params: TopviewFloorplanPluginParameterType);
51
- /** 加载户型图数据 */
52
- load(data: FloorplanServerData): Promise<void>;
18
+ /** 展示户型图图前,Five Panorama Longitude */
19
+ private lastPanoramaLongitude;
20
+ /** 户型图大小 */
21
+ private size;
22
+ /** 是否已经执行过事件监听 */
23
+ private hasAddedEventListener;
24
+ /** 上一次隐藏是否是用户调用了 hide 导致的 */
25
+ private isHiddenByHideFunc;
26
+ constructor(five: Five, params?: Parameters);
27
+ load(serverData: PluginServerData | FloorplanServerData, state?: Partial<State>, userAction?: boolean): Promise<void>;
28
+ /** 更新户型图大小 */
29
+ updateSize: () => void;
30
+ /** 更新户型图位置 */
31
+ updatePosition(): void;
53
32
  /** 把插件的渲染DOM插入到对应的容器中去 */
54
33
  appendTo(wrapper: Element): this;
34
+ show(options?: BaseOptions): Promise<void>;
35
+ hide(options?: BaseOptions): Promise<void>;
36
+ enable(options?: BaseOptions): void;
37
+ disable(options?: BaseOptions): void;
38
+ /** 销毁插件 */
55
39
  dispose: () => void;
56
- private onFiveWantsMoveToPano;
57
- private onFiveWantsGesture;
58
- private onModelShownFloorChange;
59
- private onFivePanoArrived;
60
- private onFivePanGesture;
61
- private onFivePinchGesture;
40
+ /** 更改插件 State */
41
+ setState(state: Partial<State>, options?: BaseOptions): void;
42
+ protected formatData(serverData: PluginServerData): Promise<PluginData>;
43
+ private _show;
44
+ private _hide;
45
+ private _enable;
46
+ private _disable;
47
+ private updateState;
48
+ private addEventListener;
49
+ private removeEventListener;
50
+ /** modelLoaded 之后自动执行 append container 操作 */
62
51
  private onFiveModelLoaded;
63
52
  /** 非 Topview 态隐藏户型图 */
64
53
  private onFiveModeChange;
54
+ private onFivePanoArrived;
55
+ private onFiveCameraUpdate;
56
+ private onFiveWantsGesture;
57
+ private onFiveWantsMoveToPano;
65
58
  /** 动画结束后是 Topview 态就展示户型图 */
66
59
  private onFiveInitAnimationEnded;
67
- private show;
68
- private hide;
69
- /** 更新户型图大小 */
70
- private updateSize;
71
- /** 更新户型图位置 */
72
- private updatePosition;
60
+ private onModelShownFloorChange;
61
+ /** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
62
+ *
63
+ * - TODO: 等 selector 功能下掉之后删除这个逻辑
64
+ */
65
+ private initContainer;
73
66
  private render;
74
67
  }
75
- export {};