@realsee/dnalogel 2.0.0-alpha.35 → 2.0.0-alpha.38
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.
- package/dist/ItemLabelPlugin/index.js +21 -41
- package/dist/ModelItemLabelPlugin/index.js +16 -36
- package/dist/ModelViewPlugin/Plugin.d.ts +4 -4
- package/dist/ModelViewPlugin/index.js +2 -3
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +0 -4
- package/dist/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +0 -3
- package/dist/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/{NewMainBtnController.d.ts → mobileMainBtnController.d.ts} +1 -1
- package/dist/PanoMeasurePlugin/Modules/UIController/style.d.ts +0 -3
- package/dist/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +2 -0
- package/dist/PanoMeasurePlugin/index.js +298 -331
- package/dist/PanoMeasurePlugin/typings/data.d.ts +5 -0
- package/dist/PanoMeasurePlugin/utils/mouseGroup.d.ts +6 -1
- package/dist/PanoRulerProPlugin/Controller.d.ts +15 -0
- package/dist/PanoRulerProPlugin/index.d.ts +8 -0
- package/dist/PanoRulerProPlugin/index.js +1006 -0
- package/dist/PanoRulerProPlugin/typings.d.ts +46 -0
- package/dist/base/BasePlugin.d.ts +100 -0
- package/dist/base/BasePluginWithData.d.ts +34 -0
- package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +71 -78
- package/dist/floorplan/ModelFloorplanPlugin/index.d.ts +5 -7
- package/dist/floorplan/ModelFloorplanPlugin/index.js +1064 -567
- package/dist/floorplan/ModelFloorplanPlugin/typing.d.ts +107 -0
- package/dist/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +23 -14
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.d.ts +5 -6
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +489 -129
- package/dist/floorplan/PanoFloorplanRadarPlugin/typing.d.ts +52 -0
- package/dist/floorplan/TopviewFloorplanPlugin/Controller.d.ts +50 -58
- package/dist/floorplan/TopviewFloorplanPlugin/index.d.ts +5 -3
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +1031 -443
- package/dist/floorplan/TopviewFloorplanPlugin/typing.d.ts +86 -0
- package/{libs/floorplan/ModelFloorplanPlugin → dist/floorplan}/utils/constant.d.ts +10 -3
- package/{libs/floorplan/ModelFloorplanPlugin → dist/floorplan}/utils/correctFiveState.d.ts +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +3173 -1633
- package/dist/index.js +3194 -1653
- package/dist/index.umd.js +3090 -1549
- package/dist/shared-utils/five/changeMode.d.ts +4 -1
- package/dist/shared-utils/getPxmm.d.ts +8 -0
- package/dist/shared-utils/logger.d.ts +16 -0
- package/docs/assets/search.js +1 -1
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- package/docs/enums/CameraMovementEffect.html +2 -2
- package/docs/enums/DIRECTION.html +1 -1
- package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/Rotation.html +2 -2
- package/docs/index.html +2 -2
- package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
- package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/FloorplanBounding.html +4 -4
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +7 -7
- package/docs/interfaces/FloorplanExtraObject.html +3 -3
- package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
- package/docs/interfaces/FloorplanFloorData.html +2 -2
- package/docs/interfaces/FloorplanImagePosition.html +2 -2
- package/docs/interfaces/FloorplanObserver.html +2 -2
- package/docs/interfaces/FloorplanOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanPosition.html +2 -2
- package/docs/interfaces/FloorplanRoomItem.html +6 -6
- package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
- package/docs/interfaces/FloorplanServerBounding.html +4 -4
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerEntrance.html +7 -7
- package/docs/interfaces/FloorplanServerFloorData.html +2 -2
- package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
- package/docs/interfaces/FloorplanServerObserver.html +2 -2
- package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanServerPosition.html +2 -2
- package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
- package/docs/interfaces/ItemLabelPluginData.html +1 -1
- package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/LineJson.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
- package/docs/interfaces/ModelViewPluginExportType.html +1 -1
- package/docs/interfaces/OpenParameter.html +2 -2
- package/docs/interfaces/PanoCompassPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
- package/docs/interfaces/PanoMeasureParameterType.html +1 -1
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginExportType.html +1 -0
- package/docs/interfaces/PanoRulerProPluginOptions.html +1 -0
- package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -0
- package/docs/interfaces/PanoRulerProPluginState.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
- package/docs/interfaces/Point.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/Room.html +1 -1
- package/docs/interfaces/RoomInfo.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/RoomRules.html +1 -1
- package/docs/interfaces/Rooms.html +1 -1
- package/docs/modules.html +19 -27
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +21 -41
- package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +16 -36
- package/libs/ModelViewPlugin/Plugin.d.ts +4 -4
- package/libs/ModelViewPlugin/Plugin.js +2 -3
- package/libs/PanoMeasurePlugin/Controller/index.js +4 -2
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.js +1 -1
- package/libs/PanoMeasurePlugin/Modules/GuideController.js +2 -2
- package/libs/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +0 -4
- package/libs/PanoMeasurePlugin/Modules/UIController/HTML.js +66 -55
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +0 -3
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +51 -73
- package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +7 -4
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +10 -12
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.js +2 -2
- package/libs/PanoMeasurePlugin/Modules/UIController/{NewMainBtnController.d.ts → mobileMainBtnController.d.ts} +1 -1
- package/libs/PanoMeasurePlugin/Modules/UIController/{NewMainBtnController.js → mobileMainBtnController.js} +4 -4
- package/libs/PanoMeasurePlugin/Modules/UIController/style.d.ts +0 -3
- package/libs/PanoMeasurePlugin/Modules/UIController/style.js +7 -24
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.js +1 -1
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.js +1 -2
- package/libs/PanoMeasurePlugin/typings/data.d.ts +5 -0
- package/libs/PanoMeasurePlugin/utils/mouseGroup.d.ts +6 -1
- package/libs/PanoMeasurePlugin/utils/mouseGroup.js +55 -7
- package/libs/PanoRulerProPlugin/Controller.d.ts +15 -0
- package/libs/PanoRulerProPlugin/Controller.js +110 -0
- package/libs/PanoRulerProPlugin/RulerItem.js +314 -0
- package/libs/PanoRulerProPlugin/RulerItems.js +377 -0
- package/libs/PanoRulerProPlugin/index.d.ts +8 -0
- package/libs/PanoRulerProPlugin/index.js +8 -0
- package/libs/PanoRulerProPlugin/typings.d.ts +46 -0
- package/libs/{floorplan/ModelFloorplanPlugin/typings/events.type.js → PanoRulerProPlugin/typings.js} +0 -0
- package/libs/base/BasePlugin.d.ts +100 -0
- package/libs/base/BasePlugin.js +31 -0
- package/libs/base/BasePluginWithData.d.ts +34 -0
- package/libs/base/BasePluginWithData.js +4 -0
- package/libs/floorplan/Components/Compass.js +11 -11
- package/libs/floorplan/Components/CurrentFloor.js +24 -11
- package/libs/floorplan/Components/Main.js +21 -15
- package/libs/floorplan/Components/RoomHighlight/Room.js +44 -5
- package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +29 -12
- package/libs/floorplan/Components/RoomLabels/RoomLabel.js +164 -15
- package/libs/floorplan/Components/RoomLabels/RoomLabels.js +68 -24
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_1.js +1 -0
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_2.js +11 -9
- package/libs/floorplan/Components/RuleLabels/RuleItem.js +2 -2
- package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +71 -78
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +439 -272
- package/libs/floorplan/ModelFloorplanPlugin/index.d.ts +5 -7
- package/libs/floorplan/ModelFloorplanPlugin/index.js +2 -2
- package/libs/floorplan/ModelFloorplanPlugin/typing.d.ts +107 -0
- package/libs/floorplan/ModelFloorplanPlugin/typing.js +1 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Camera.js +5 -5
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Main.js +114 -53
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +23 -14
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +162 -52
- package/libs/floorplan/PanoFloorplanRadarPlugin/index.d.ts +5 -6
- package/libs/floorplan/PanoFloorplanRadarPlugin/index.js +2 -2
- package/libs/floorplan/PanoFloorplanRadarPlugin/typing.d.ts +52 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/typing.js +1 -0
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.d.ts +50 -58
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +320 -174
- package/libs/floorplan/TopviewFloorplanPlugin/index.d.ts +5 -3
- package/libs/floorplan/TopviewFloorplanPlugin/index.js +2 -2
- package/libs/floorplan/TopviewFloorplanPlugin/style.js +1 -1
- package/libs/floorplan/TopviewFloorplanPlugin/typing.d.ts +86 -0
- package/libs/floorplan/TopviewFloorplanPlugin/typing.js +1 -0
- package/{dist/floorplan/ModelFloorplanPlugin → libs/floorplan}/utils/constant.d.ts +10 -3
- package/libs/floorplan/{ModelFloorplanPlugin/utils → utils}/constant.js +9 -2
- package/{dist/floorplan/ModelFloorplanPlugin → libs/floorplan}/utils/correctFiveState.d.ts +2 -1
- package/libs/floorplan/{ModelFloorplanPlugin/utils → utils}/correctFiveState.js +16 -16
- package/libs/index.d.ts +1 -0
- package/libs/index.js +2 -0
- package/libs/shared-utils/five/changeMode.d.ts +4 -1
- package/libs/shared-utils/five/changeMode.js +34 -13
- package/libs/shared-utils/getPxmm.d.ts +8 -0
- package/libs/shared-utils/getPxmm.js +25 -20
- package/libs/shared-utils/logger.d.ts +16 -0
- package/libs/shared-utils/logger.js +47 -0
- package/package.json +2 -2
- package/dist/floorplan/ModelFloorplanPlugin/typings/events.type.d.ts +0 -23
- package/docs/classes/PanoFloorplanRadarPluginController.html +0 -3
- package/docs/enums/ModelFloorplanErrorType.html +0 -1
- package/docs/interfaces/ModelFloorplanParameterType.html +0 -1
- package/docs/interfaces/ModelFloorplanViewEvent.html +0 -5
- package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +0 -1
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +0 -19
- package/libs/ModelSimulationPlugin/index.d.ts +0 -33
- package/libs/ModelSimulationPlugin/index.js +0 -166
- package/libs/ModelSimulationPlugin/shaders/fragment.d.ts +0 -2
- package/libs/ModelSimulationPlugin/shaders/fragment.js +0 -96
- package/libs/ModelSimulationPlugin/shaders/vertex.d.ts +0 -2
- package/libs/ModelSimulationPlugin/shaders/vertex.js +0 -23
- package/libs/floorplan/ModelFloorplanPlugin/Assets/compass.d.ts +0 -1
- package/libs/floorplan/ModelFloorplanPlugin/Assets/compass.js +0 -1
- package/libs/floorplan/ModelFloorplanPlugin/Components/Camera.js +0 -120
- package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +0 -106
- package/libs/floorplan/ModelFloorplanPlugin/Components/CurrentFloor/CurrentFloor.js +0 -463
- package/libs/floorplan/ModelFloorplanPlugin/Components/Main.js +0 -375
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +0 -171
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabels.js +0 -265
- package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleItem.js +0 -301
- package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleLabels.js +0 -219
- package/libs/floorplan/ModelFloorplanPlugin/typings/events.type.d.ts +0 -23
- package/libs/shared-utils/five/useFivePlugin.d.ts +0 -1
- package/libs/shared-utils/five/useFivePlugin.js +0 -8
- package/libs/shared-utils/useDebounce.d.ts +0 -8
- package/libs/shared-utils/useDebounce.js +0 -22
- package/libs/shared-utils/useThrottle.d.ts +0 -8
- package/libs/shared-utils/useThrottle.js +0 -25
|
@@ -1,37 +1,44 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import
|
|
2
|
+
import equal from '../../shared-utils/equal';
|
|
3
|
+
import Main from '../Components/Main';
|
|
3
4
|
import formatData from '../utils/formatData';
|
|
4
|
-
import
|
|
5
|
+
import { CAMERA_IMAGE } from '../Assets/camera';
|
|
5
6
|
import { omit } from '../../shared-utils/filter';
|
|
6
|
-
import
|
|
7
|
+
import { FLOOR_PLAN_ATTACHED_TO } from '../constant';
|
|
8
|
+
import * as BasePlugin from '../../base/BasePluginWithData';
|
|
9
|
+
import changeMode from '../../shared-utils/five/changeMode';
|
|
10
|
+
import getPxmm, { getAttachedY } from '../../shared-utils/getPxmm';
|
|
7
11
|
import changeModelCanvasOpacity from '../../shared-utils/changeModelCanvasOpacity';
|
|
8
|
-
export class
|
|
12
|
+
export class Controller extends BasePlugin.Controller {
|
|
9
13
|
constructor(five, params) {
|
|
10
|
-
|
|
14
|
+
super(five);
|
|
15
|
+
// =============== public properties =================
|
|
16
|
+
Object.defineProperty(this, "name", {
|
|
11
17
|
enumerable: true,
|
|
12
18
|
configurable: true,
|
|
13
19
|
writable: true,
|
|
14
|
-
value:
|
|
20
|
+
value: 'topviewFloorplanPlugin'
|
|
15
21
|
});
|
|
16
|
-
Object.defineProperty(this, "
|
|
22
|
+
Object.defineProperty(this, "state", {
|
|
17
23
|
enumerable: true,
|
|
18
24
|
configurable: true,
|
|
19
25
|
writable: true,
|
|
20
|
-
value:
|
|
26
|
+
value: void 0
|
|
21
27
|
});
|
|
22
|
-
|
|
28
|
+
// =============== private properties =================
|
|
29
|
+
Object.defineProperty(this, "data", {
|
|
23
30
|
enumerable: true,
|
|
24
31
|
configurable: true,
|
|
25
32
|
writable: true,
|
|
26
|
-
value: 0
|
|
33
|
+
value: void 0
|
|
27
34
|
});
|
|
28
35
|
Object.defineProperty(this, "app", {
|
|
29
36
|
enumerable: true,
|
|
30
37
|
configurable: true,
|
|
31
38
|
writable: true,
|
|
32
|
-
value:
|
|
39
|
+
value: undefined
|
|
33
40
|
});
|
|
34
|
-
Object.defineProperty(this, "
|
|
41
|
+
Object.defineProperty(this, "selector", {
|
|
35
42
|
enumerable: true,
|
|
36
43
|
configurable: true,
|
|
37
44
|
writable: true,
|
|
@@ -49,98 +56,136 @@ export class TopviewFloorplanPluginController {
|
|
|
49
56
|
writable: true,
|
|
50
57
|
value: 0
|
|
51
58
|
});
|
|
52
|
-
|
|
59
|
+
/** 户型图父容器 */
|
|
60
|
+
Object.defineProperty(this, "wrapper", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
configurable: true,
|
|
63
|
+
writable: true,
|
|
64
|
+
value: void 0
|
|
65
|
+
});
|
|
66
|
+
/** 户型图主容器 */
|
|
67
|
+
Object.defineProperty(this, "container", {
|
|
53
68
|
enumerable: true,
|
|
54
69
|
configurable: true,
|
|
55
70
|
writable: true,
|
|
56
|
-
value:
|
|
71
|
+
value: document.createElement('div')
|
|
57
72
|
});
|
|
73
|
+
/** 展示户型图图前,Five 的 Panorama Longitude */
|
|
58
74
|
Object.defineProperty(this, "lastPanoramaLongitude", {
|
|
59
75
|
enumerable: true,
|
|
60
76
|
configurable: true,
|
|
61
77
|
writable: true,
|
|
62
78
|
value: 0
|
|
63
79
|
});
|
|
64
|
-
|
|
80
|
+
/** 户型图大小 */
|
|
81
|
+
Object.defineProperty(this, "size", {
|
|
65
82
|
enumerable: true,
|
|
66
83
|
configurable: true,
|
|
67
84
|
writable: true,
|
|
68
|
-
value:
|
|
85
|
+
value: { width: 0, height: 0 }
|
|
69
86
|
});
|
|
70
|
-
|
|
87
|
+
/** 是否已经执行过事件监听 */
|
|
88
|
+
Object.defineProperty(this, "hasAddedEventListener", {
|
|
71
89
|
enumerable: true,
|
|
72
90
|
configurable: true,
|
|
73
91
|
writable: true,
|
|
74
|
-
value:
|
|
92
|
+
value: false
|
|
75
93
|
});
|
|
76
|
-
|
|
94
|
+
/** 上一次隐藏是否是用户调用了 hide 导致的 */
|
|
95
|
+
Object.defineProperty(this, "isHiddenByHideFunc", {
|
|
77
96
|
enumerable: true,
|
|
78
97
|
configurable: true,
|
|
79
98
|
writable: true,
|
|
80
|
-
value:
|
|
99
|
+
value: false
|
|
81
100
|
});
|
|
82
|
-
|
|
101
|
+
/** 更新户型图大小 */
|
|
102
|
+
Object.defineProperty(this, "updateSize", {
|
|
83
103
|
enumerable: true,
|
|
84
104
|
configurable: true,
|
|
85
105
|
writable: true,
|
|
86
|
-
value:
|
|
106
|
+
value: () => {
|
|
107
|
+
if (!this.data)
|
|
108
|
+
return;
|
|
109
|
+
if (!this.container || !this.wrapper)
|
|
110
|
+
return;
|
|
111
|
+
if (this.five.getCurrentState().mode !== 'Topview')
|
|
112
|
+
return;
|
|
113
|
+
// 计算户型图展示大小
|
|
114
|
+
const { min, max } = this.data.bounding;
|
|
115
|
+
const width = max.x - min.x;
|
|
116
|
+
const height = max.y - min.y;
|
|
117
|
+
// 每毫米对应的 px 值
|
|
118
|
+
const options = this.state.config.attachedTo ? { attachedTo: this.state.config.attachedTo } : undefined;
|
|
119
|
+
const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
|
|
120
|
+
const _width = Math.ceil(width * pxmm);
|
|
121
|
+
const _height = Math.ceil(height * pxmm);
|
|
122
|
+
if (this.size.width === _width && this.size.height === _height)
|
|
123
|
+
return;
|
|
124
|
+
this.container.style.width = _width + 'px';
|
|
125
|
+
this.container.style.height = _height + 'px';
|
|
126
|
+
this.size = { width: _width, height: _height };
|
|
127
|
+
}
|
|
87
128
|
});
|
|
129
|
+
/** 销毁插件 */
|
|
88
130
|
Object.defineProperty(this, "dispose", {
|
|
89
131
|
enumerable: true,
|
|
90
132
|
configurable: true,
|
|
91
133
|
writable: true,
|
|
92
134
|
value: () => {
|
|
93
135
|
var _a, _b;
|
|
94
|
-
this.
|
|
136
|
+
this.removeEventListener();
|
|
95
137
|
(_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
|
|
138
|
+
this.app = undefined;
|
|
96
139
|
(_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
|
|
97
|
-
this.
|
|
98
|
-
this.
|
|
99
|
-
this.
|
|
100
|
-
this.
|
|
101
|
-
this.five.off('pinchGesture', this.onFivePinchGesture);
|
|
102
|
-
this.five.off('wantsGesture', this.onFiveWantsGesture);
|
|
103
|
-
this.five.off('wantsMoveToPano', this.onFiveWantsMoveToPano);
|
|
104
|
-
this.five.off('initAnimationEnded', this.onFiveInitAnimationEnded);
|
|
105
|
-
this.five.off('modelShownFloorChange', this.onModelShownFloorChange);
|
|
140
|
+
this.data = undefined;
|
|
141
|
+
this.wrapper = undefined;
|
|
142
|
+
this.selector = undefined;
|
|
143
|
+
this.hooks.emit('dispose');
|
|
106
144
|
}
|
|
107
145
|
});
|
|
108
|
-
Object.defineProperty(this, "
|
|
146
|
+
Object.defineProperty(this, "_disable", {
|
|
109
147
|
enumerable: true,
|
|
110
148
|
configurable: true,
|
|
111
149
|
writable: true,
|
|
112
|
-
value: () => {
|
|
113
|
-
|
|
114
|
-
|
|
150
|
+
value: (options) => {
|
|
151
|
+
var _a, _b;
|
|
152
|
+
const { userAction } = options;
|
|
153
|
+
(_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
|
|
154
|
+
this.app = undefined;
|
|
155
|
+
(_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
|
|
156
|
+
this.removeEventListener();
|
|
157
|
+
this.hooks.emit('disable', { userAction });
|
|
115
158
|
}
|
|
116
159
|
});
|
|
117
|
-
|
|
160
|
+
/** modelLoaded 之后自动执行 append container 操作 */
|
|
161
|
+
Object.defineProperty(this, "onFiveModelLoaded", {
|
|
118
162
|
enumerable: true,
|
|
119
163
|
configurable: true,
|
|
120
164
|
writable: true,
|
|
121
|
-
value: (
|
|
122
|
-
if (
|
|
165
|
+
value: () => {
|
|
166
|
+
if (this.state.enabled === false)
|
|
123
167
|
return;
|
|
124
|
-
if (this.
|
|
125
|
-
return
|
|
168
|
+
if (this.wrapper)
|
|
169
|
+
return;
|
|
170
|
+
if (!this.selector)
|
|
171
|
+
return;
|
|
172
|
+
const wrapper = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
|
|
173
|
+
if (!wrapper)
|
|
174
|
+
throw new Error('不正确的父容器选择器');
|
|
175
|
+
this.wrapper = wrapper;
|
|
176
|
+
wrapper.append(this.container);
|
|
126
177
|
}
|
|
127
178
|
});
|
|
128
|
-
|
|
179
|
+
/** 非 Topview 态隐藏户型图 */
|
|
180
|
+
Object.defineProperty(this, "onFiveModeChange", {
|
|
129
181
|
enumerable: true,
|
|
130
182
|
configurable: true,
|
|
131
183
|
writable: true,
|
|
132
|
-
value: (
|
|
133
|
-
if (this.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const panoIndex = this.five.getCurrentState().panoIndex;
|
|
137
|
-
this.floorIndex = this.five.work.observers[panoIndex].floorIndex;
|
|
138
|
-
return;
|
|
184
|
+
value: (...[mode, , , , userAction]) => {
|
|
185
|
+
if (mode !== 'Topview' && this.state.visible) {
|
|
186
|
+
this.updateState({ visible: false }, userAction);
|
|
187
|
+
this._hide({ userAction });
|
|
139
188
|
}
|
|
140
|
-
// 模型楼层高亮改变时,自动进行楼层切换
|
|
141
|
-
this.floorIndex = shownFloor;
|
|
142
|
-
this.updateSize();
|
|
143
|
-
this.render();
|
|
144
189
|
}
|
|
145
190
|
});
|
|
146
191
|
Object.defineProperty(this, "onFivePanoArrived", {
|
|
@@ -155,51 +200,35 @@ export class TopviewFloorplanPluginController {
|
|
|
155
200
|
this.floorIndex = this.five.work.observers[index].floorIndex;
|
|
156
201
|
}
|
|
157
202
|
});
|
|
158
|
-
Object.defineProperty(this, "
|
|
203
|
+
Object.defineProperty(this, "onFiveCameraUpdate", {
|
|
159
204
|
enumerable: true,
|
|
160
205
|
configurable: true,
|
|
161
206
|
writable: true,
|
|
162
|
-
value: () => {
|
|
163
|
-
if (!this.visible)
|
|
164
|
-
return;
|
|
165
|
-
this.updatePosition();
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
Object.defineProperty(this, "onFivePinchGesture", {
|
|
169
|
-
enumerable: true,
|
|
170
|
-
configurable: true,
|
|
171
|
-
writable: true,
|
|
172
|
-
value: () => {
|
|
173
|
-
if (!this.visible)
|
|
207
|
+
value: (_, userAction) => {
|
|
208
|
+
if (!this.state.visible)
|
|
174
209
|
return;
|
|
175
210
|
this.updatePosition();
|
|
176
211
|
this.updateSize();
|
|
177
212
|
}
|
|
178
213
|
});
|
|
179
|
-
Object.defineProperty(this, "
|
|
214
|
+
Object.defineProperty(this, "onFiveWantsGesture", {
|
|
180
215
|
enumerable: true,
|
|
181
216
|
configurable: true,
|
|
182
217
|
writable: true,
|
|
183
|
-
value: () => {
|
|
184
|
-
if (
|
|
185
|
-
return;
|
|
186
|
-
if (!this.selector)
|
|
218
|
+
value: (type) => {
|
|
219
|
+
if (type !== 'pan' && type !== 'pinch' && type !== 'mouseWheel')
|
|
187
220
|
return;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
throw new Error('不正确的父容器选择器');
|
|
191
|
-
this.wrapper = wrapper;
|
|
192
|
-
wrapper.append(this.container);
|
|
221
|
+
if (this.state.visible && !this.state.config.gestureEnable)
|
|
222
|
+
return false;
|
|
193
223
|
}
|
|
194
224
|
});
|
|
195
|
-
|
|
196
|
-
Object.defineProperty(this, "onFiveModeChange", {
|
|
225
|
+
Object.defineProperty(this, "onFiveWantsMoveToPano", {
|
|
197
226
|
enumerable: true,
|
|
198
227
|
configurable: true,
|
|
199
228
|
writable: true,
|
|
200
|
-
value: (
|
|
201
|
-
if (
|
|
202
|
-
return
|
|
229
|
+
value: () => {
|
|
230
|
+
if (this.state.visible && this.state.config.preventRoomClick)
|
|
231
|
+
return false;
|
|
203
232
|
}
|
|
204
233
|
});
|
|
205
234
|
/** 动画结束后是 Topview 态就展示户型图 */
|
|
@@ -207,134 +236,251 @@ export class TopviewFloorplanPluginController {
|
|
|
207
236
|
enumerable: true,
|
|
208
237
|
configurable: true,
|
|
209
238
|
writable: true,
|
|
210
|
-
value: () => {
|
|
239
|
+
value: (...[, , userAction]) => {
|
|
211
240
|
const { mode } = this.five.getCurrentState();
|
|
212
|
-
if (mode === 'Topview')
|
|
213
|
-
this.
|
|
241
|
+
if (mode === 'Topview' && !this.isHiddenByHideFunc && !this.state.visible && this.state.config.autoShowEnable) {
|
|
242
|
+
this.updateState({ visible: true }, userAction);
|
|
243
|
+
this._show({ userAction });
|
|
244
|
+
}
|
|
214
245
|
}
|
|
215
246
|
});
|
|
216
|
-
|
|
217
|
-
Object.defineProperty(this, "updateSize", {
|
|
247
|
+
Object.defineProperty(this, "onModelShownFloorChange", {
|
|
218
248
|
enumerable: true,
|
|
219
249
|
configurable: true,
|
|
220
250
|
writable: true,
|
|
221
|
-
value: () => {
|
|
222
|
-
if (
|
|
223
|
-
return;
|
|
224
|
-
if (!this.container || !this.wrapper)
|
|
251
|
+
value: (shownFloor) => {
|
|
252
|
+
if (this.floorIndex === shownFloor)
|
|
225
253
|
return;
|
|
226
|
-
if (
|
|
254
|
+
if (shownFloor === null) {
|
|
255
|
+
const panoIndex = this.five.getCurrentState().panoIndex;
|
|
256
|
+
this.floorIndex = this.five.work.observers[panoIndex].floorIndex;
|
|
227
257
|
return;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const options = this.configs.attachedTo ? { attachedTo: this.configs.attachedTo } : undefined;
|
|
234
|
-
const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
|
|
235
|
-
const _width = Math.ceil(width * pxmm);
|
|
236
|
-
const _height = Math.ceil(height * pxmm);
|
|
237
|
-
this.pxmm = pxmm;
|
|
238
|
-
this.size = { width: _width, height: _height };
|
|
239
|
-
this.container.style.width = _width + 'px';
|
|
240
|
-
this.container.style.height = _height + 'px';
|
|
258
|
+
}
|
|
259
|
+
// 模型楼层高亮改变时,自动进行楼层切换
|
|
260
|
+
this.floorIndex = shownFloor;
|
|
261
|
+
this.updateSize();
|
|
262
|
+
this.render();
|
|
241
263
|
}
|
|
242
264
|
});
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
//
|
|
248
|
-
|
|
249
|
-
|
|
265
|
+
if (params === null || params === void 0 ? void 0 : params.selector) {
|
|
266
|
+
this.selector = params.selector;
|
|
267
|
+
console.warn('不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法');
|
|
268
|
+
}
|
|
269
|
+
// =============== init State ===============
|
|
270
|
+
const baseConfig = {
|
|
271
|
+
northDesc: '北',
|
|
272
|
+
modelOpacity: 1,
|
|
273
|
+
hoverEnable: true,
|
|
274
|
+
compassEnable: true,
|
|
275
|
+
gestureEnable: false,
|
|
276
|
+
autoShowEnable: true,
|
|
277
|
+
ruleLabelsEnable: true,
|
|
278
|
+
roomLabelsEnable: true,
|
|
279
|
+
cameraImageUrl: CAMERA_IMAGE,
|
|
280
|
+
attachedTo: FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER,
|
|
281
|
+
getLabelElement: undefined,
|
|
282
|
+
adaptiveRoomLabelVisibleEnable: true,
|
|
283
|
+
};
|
|
284
|
+
const paramsConfig = params ? omit(params, ['selector', 'scale']) : {};
|
|
285
|
+
const config = Object.assign(Object.assign({}, baseConfig), paramsConfig);
|
|
286
|
+
this.state = {
|
|
287
|
+
enabled: true,
|
|
288
|
+
visible: false,
|
|
289
|
+
config,
|
|
290
|
+
};
|
|
291
|
+
// =============== init Container ===============
|
|
292
|
+
this.initContainer();
|
|
293
|
+
// =============== init Listener ===============
|
|
294
|
+
// 注意插件声明周期内只监听一次的事件不放在 addEventListener 里面
|
|
250
295
|
// 如果初始化的时候模型已经加载完毕了,就不用再等 modelLoaded
|
|
251
|
-
this.five.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
this.five.once('dispose', this.dispose);
|
|
255
|
-
this.five.on('modeChange', this.onFiveModeChange);
|
|
256
|
-
this.five.on('panGesture', this.onFivePanGesture);
|
|
257
|
-
this.five.on('mouseWheel', this.onFivePinchGesture);
|
|
258
|
-
this.five.on('panoArrived', this.onFivePanoArrived);
|
|
259
|
-
this.five.on('pinchGesture', this.onFivePinchGesture);
|
|
260
|
-
this.five.on('wantsGesture', this.onFiveWantsGesture);
|
|
261
|
-
this.five.on('wantsMoveToPano', this.onFiveWantsMoveToPano);
|
|
262
|
-
this.five.on('initAnimationEnded', this.onFiveInitAnimationEnded);
|
|
263
|
-
this.five.on('modelShownFloorChange', this.onModelShownFloorChange);
|
|
296
|
+
five.model.loaded ? this.onFiveModelLoaded() : five.once('modelLoaded', this.onFiveModelLoaded);
|
|
297
|
+
five.once('dispose', this.dispose);
|
|
298
|
+
this.addEventListener();
|
|
264
299
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
300
|
+
async load(serverData, state, userAction = true) {
|
|
301
|
+
function isPluginServerData(serverData) {
|
|
302
|
+
return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
|
|
303
|
+
}
|
|
304
|
+
const _data = serverData;
|
|
305
|
+
if (_data && !_data.version)
|
|
306
|
+
console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
|
|
307
|
+
const copyData = JSON.parse(JSON.stringify(serverData));
|
|
308
|
+
const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
|
|
309
|
+
const prevData = this.data;
|
|
310
|
+
this.data = await formatData(_serverData);
|
|
311
|
+
this.hooks.emit('dataLoaded', this.data);
|
|
312
|
+
this.hooks.emit('dataChange', this.data, prevData);
|
|
313
|
+
if (state)
|
|
314
|
+
this.updateState(state, userAction);
|
|
269
315
|
this.render();
|
|
270
316
|
}
|
|
317
|
+
/** 更新户型图位置 */
|
|
318
|
+
updatePosition() {
|
|
319
|
+
var _a;
|
|
320
|
+
const y = getAttachedY(this.five, this.floorIndex, this.state.config.attachedTo);
|
|
321
|
+
const modelPosition = (_a = this.five.model) === null || _a === void 0 ? void 0 : _a.bounding.getCenter(new THREE.Vector3()).setY(y);
|
|
322
|
+
if (!modelPosition)
|
|
323
|
+
return;
|
|
324
|
+
const ndcPosition = modelPosition.clone().project(this.five.camera);
|
|
325
|
+
const left = (ndcPosition.x + 1) / 2;
|
|
326
|
+
const top = -(ndcPosition.y - 1) / 2;
|
|
327
|
+
this.container.style.left = left * 100 + '%';
|
|
328
|
+
this.container.style.top = top * 100 + '%';
|
|
329
|
+
}
|
|
271
330
|
/** 把插件的渲染DOM插入到对应的容器中去 */
|
|
272
331
|
appendTo(wrapper) {
|
|
273
332
|
this.wrapper = wrapper;
|
|
333
|
+
// 插件 disabled 时,只是不执行副作用,但是 wrapper 还是要赋值的,不然 enable 的时候找不到父容器
|
|
334
|
+
if (!this.state.enabled)
|
|
335
|
+
return;
|
|
274
336
|
wrapper.appendChild(this.container);
|
|
337
|
+
this.render();
|
|
275
338
|
return this;
|
|
276
339
|
}
|
|
277
|
-
show() {
|
|
278
|
-
|
|
340
|
+
async show(options = {}) {
|
|
341
|
+
// 已经展示完成了,不做任何操作
|
|
342
|
+
if (this.state.visible)
|
|
343
|
+
return;
|
|
344
|
+
const userAction = options.userAction !== undefined ? options.userAction : true;
|
|
345
|
+
this.updateState({ visible: true }, userAction);
|
|
346
|
+
this._show({ userAction });
|
|
347
|
+
}
|
|
348
|
+
async hide(options = {}) {
|
|
349
|
+
this.isHiddenByHideFunc = true;
|
|
350
|
+
if (!this.state.visible)
|
|
351
|
+
return;
|
|
352
|
+
const userAction = options.userAction !== undefined ? options.userAction : true;
|
|
353
|
+
this.updateState({ visible: false }, userAction);
|
|
354
|
+
this._hide({ userAction });
|
|
355
|
+
}
|
|
356
|
+
enable(options = {}) {
|
|
357
|
+
if (this.state.enabled)
|
|
358
|
+
return;
|
|
359
|
+
const userAction = options.userAction !== undefined ? options.userAction : true;
|
|
360
|
+
this.updateState({ enabled: true }, options.userAction || userAction);
|
|
361
|
+
this._enable({ userAction });
|
|
362
|
+
}
|
|
363
|
+
disable(options = {}) {
|
|
364
|
+
if (!this.state.enabled)
|
|
365
|
+
return;
|
|
366
|
+
const userAction = options.userAction !== undefined ? options.userAction : true;
|
|
367
|
+
this.updateState({ enabled: false }, options.userAction || userAction);
|
|
368
|
+
this._disable({ userAction });
|
|
369
|
+
}
|
|
370
|
+
/** 更改插件 State */
|
|
371
|
+
setState(state, options = {}) {
|
|
372
|
+
const prevState = this.state;
|
|
373
|
+
const userAction = options.userAction !== undefined ? options.userAction : true;
|
|
374
|
+
this.updateState(state, userAction);
|
|
375
|
+
if (state.enabled !== undefined && prevState.enabled !== state.enabled) {
|
|
376
|
+
const options = { userAction };
|
|
377
|
+
state.enabled ? this._enable(options) : this._disable(options);
|
|
378
|
+
}
|
|
379
|
+
if (state.visible !== undefined && prevState.visible !== state.visible) {
|
|
380
|
+
const options = { userAction };
|
|
381
|
+
state.visible ? this._show(options) : this._hide(options);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
async formatData(serverData) {
|
|
385
|
+
return await formatData(serverData.data);
|
|
386
|
+
}
|
|
387
|
+
async _show(options) {
|
|
388
|
+
if (!this.state.enabled)
|
|
389
|
+
return;
|
|
390
|
+
this.isHiddenByHideFunc = false;
|
|
391
|
+
const { userAction } = options;
|
|
392
|
+
this.hooks.emit('show', { userAction });
|
|
393
|
+
if (this.five.getCurrentState().mode !== 'Topview') {
|
|
394
|
+
await changeMode(this.five, ['Topview', undefined, undefined, userAction]);
|
|
395
|
+
}
|
|
279
396
|
this.five.model.show(this.floorIndex);
|
|
280
397
|
this.updatePosition();
|
|
281
398
|
this.updateSize();
|
|
282
399
|
const renderDuration = 500;
|
|
283
|
-
const modelOpacity = this.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
this.render(renderDuration);
|
|
400
|
+
const modelOpacity = this.state.config.modelOpacity;
|
|
401
|
+
changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
|
|
402
|
+
this.hooks.emit('showAnimationEnded', { userAction });
|
|
403
|
+
this.render();
|
|
288
404
|
}
|
|
289
|
-
|
|
405
|
+
async _hide(options) {
|
|
406
|
+
if (!this.state.enabled)
|
|
407
|
+
return;
|
|
408
|
+
const { userAction } = options;
|
|
409
|
+
this.hooks.emit('hide', { userAction });
|
|
290
410
|
const modelOpacity = 1;
|
|
291
411
|
const renderDuration = 0;
|
|
292
|
-
this.visible = false;
|
|
293
412
|
changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
|
|
294
413
|
this.render();
|
|
295
414
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
415
|
+
_enable(options) {
|
|
416
|
+
const { userAction } = options;
|
|
417
|
+
this.addEventListener();
|
|
418
|
+
if (this.wrapper)
|
|
419
|
+
this.wrapper.append(this.container);
|
|
420
|
+
this.hooks.emit('enable', { userAction });
|
|
421
|
+
if (this.state.visible)
|
|
422
|
+
this._show({ userAction });
|
|
423
|
+
}
|
|
424
|
+
updateState(state, userAction) {
|
|
425
|
+
const prevState = this.state;
|
|
426
|
+
this.state = Object.assign(Object.assign({}, this.state), state);
|
|
427
|
+
if (equal(this.state, prevState, { deep: true }))
|
|
301
428
|
return;
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
this.
|
|
306
|
-
|
|
429
|
+
this.hooks.emit('stateChange', { state: this.state, prevState, userAction });
|
|
430
|
+
}
|
|
431
|
+
addEventListener() {
|
|
432
|
+
if (!this.state.enabled)
|
|
433
|
+
return;
|
|
434
|
+
if (this.hasAddedEventListener)
|
|
435
|
+
return;
|
|
436
|
+
const five = this.five;
|
|
437
|
+
five.on('modeChange', this.onFiveModeChange);
|
|
438
|
+
five.on('panoArrived', this.onFivePanoArrived);
|
|
439
|
+
five.on('cameraUpdate', this.onFiveCameraUpdate);
|
|
440
|
+
five.on('wantsGesture', this.onFiveWantsGesture);
|
|
441
|
+
five.on('wantsMoveToPano', this.onFiveWantsMoveToPano);
|
|
442
|
+
five.on('initAnimationEnded', this.onFiveInitAnimationEnded);
|
|
443
|
+
five.on('modelShownFloorChange', this.onModelShownFloorChange);
|
|
444
|
+
}
|
|
445
|
+
removeEventListener() {
|
|
446
|
+
const five = this.five;
|
|
447
|
+
this.hasAddedEventListener = false;
|
|
448
|
+
// 注意这里并没有消除 dispose 的监听
|
|
449
|
+
five.off('modeChange', this.onFiveModeChange);
|
|
450
|
+
five.off('panoArrived', this.onFivePanoArrived);
|
|
451
|
+
five.off('cameraUpdate', this.onFiveCameraUpdate);
|
|
452
|
+
five.off('wantsGesture', this.onFiveWantsGesture);
|
|
453
|
+
five.off('wantsMoveToPano', this.onFiveWantsMoveToPano);
|
|
454
|
+
five.off('initAnimationEnded', this.onFiveInitAnimationEnded);
|
|
455
|
+
five.off('modelShownFloorChange', this.onModelShownFloorChange);
|
|
456
|
+
}
|
|
457
|
+
/** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
|
|
458
|
+
*
|
|
459
|
+
* - TODO: 等 selector 功能下掉之后删除这个逻辑
|
|
460
|
+
*/
|
|
461
|
+
initContainer() {
|
|
462
|
+
this.container.classList.add('floorplan-plugin');
|
|
463
|
+
Object.assign(this.container.style, {
|
|
464
|
+
position: 'absolute',
|
|
465
|
+
left: '50%',
|
|
466
|
+
top: '50%',
|
|
467
|
+
transform: 'translate3d(-50%, -50%, 10px)',
|
|
468
|
+
zIndex: 10,
|
|
469
|
+
pointerEvents: 'none',
|
|
470
|
+
'will-change': 'width, height',
|
|
471
|
+
});
|
|
472
|
+
this.five.addExtraElement(this.container);
|
|
307
473
|
}
|
|
308
474
|
render(duration) {
|
|
309
|
-
if (!this.
|
|
475
|
+
if (!this.state.enabled)
|
|
476
|
+
return;
|
|
477
|
+
if (!this.container || !this.data)
|
|
310
478
|
return;
|
|
311
479
|
if (this.size.width === 0)
|
|
312
480
|
return;
|
|
313
|
-
const {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
cameraImageUrl,
|
|
318
|
-
visible: this.visible,
|
|
319
|
-
duration: duration !== null && duration !== void 0 ? duration : 0,
|
|
320
|
-
panoIndex: this.panoIndex,
|
|
321
|
-
floorIndex: this.floorIndex,
|
|
322
|
-
floorplanData: this.floorplanData,
|
|
323
|
-
hoverEnable: hoverEnable !== null && hoverEnable !== void 0 ? hoverEnable : false,
|
|
324
|
-
compassEnable: compassEnable !== null && compassEnable !== void 0 ? compassEnable : true,
|
|
325
|
-
ruleLabelsEnable: ruleLabelsEnable !== null && ruleLabelsEnable !== void 0 ? ruleLabelsEnable : true,
|
|
326
|
-
roomLabelsEnable: roomLabelsEnable !== null && roomLabelsEnable !== void 0 ? roomLabelsEnable : true,
|
|
327
|
-
lastPanoramaLongitude: this.lastPanoramaLongitude,
|
|
328
|
-
};
|
|
329
|
-
if (!this.app) {
|
|
330
|
-
this.app = new Main({
|
|
331
|
-
target: this.container,
|
|
332
|
-
intro: true,
|
|
333
|
-
props,
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
this.app.$set(props);
|
|
338
|
-
}
|
|
481
|
+
const props = Object.assign(Object.assign({}, this.state.config), { visible: this.state.visible, duration: duration !== null && duration !== void 0 ? duration : 0, panoIndex: this.panoIndex, floorIndex: this.floorIndex, floorplanData: this.data, lastPanoramaLongitude: this.lastPanoramaLongitude });
|
|
482
|
+
if (this.app)
|
|
483
|
+
return this.app.$set(props);
|
|
484
|
+
this.app = new Main({ target: this.container, intro: true, props });
|
|
339
485
|
}
|
|
340
486
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { Parameters } from './typing';
|
|
1
2
|
import type { FivePlugin } from '@realsee/five';
|
|
2
|
-
import {
|
|
3
|
-
export declare const TopviewFloorplanPlugin: FivePlugin<
|
|
3
|
+
import { Controller } from './Controller';
|
|
4
|
+
export declare const TopviewFloorplanPlugin: FivePlugin<undefined | Parameters, Controller>;
|
|
5
|
+
export declare type TopviewFloorplanPluginParameterType = Parameters | undefined;
|
|
6
|
+
export declare type TopviewFloorplanPluginReturnType = InstanceType<typeof Controller>;
|
|
4
7
|
export default TopviewFloorplanPlugin;
|
|
5
|
-
export type { TopviewFloorplanPluginReturnType, TopviewFloorplanPluginParameterType } from './Controller';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Controller } from './Controller';
|
|
2
2
|
export const TopviewFloorplanPlugin = (five, params) => {
|
|
3
|
-
return new
|
|
3
|
+
return new Controller(five, params);
|
|
4
4
|
};
|
|
5
5
|
export default TopviewFloorplanPlugin;
|