@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.
- package/dist/ItemLabelPlugin/index.js +21 -41
- package/dist/ModelItemLabelPlugin/index.js +16 -36
- 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/base/BasePlugin.d.ts +100 -0
- package/dist/base/BasePluginWithData.d.ts +34 -0
- package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +70 -78
- package/dist/floorplan/ModelFloorplanPlugin/index.d.ts +5 -7
- package/dist/floorplan/ModelFloorplanPlugin/index.js +1059 -569
- 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.es.js +2184 -1411
- package/dist/index.js +2188 -1415
- package/dist/index.umd.js +2142 -1369
- package/dist/shared-utils/five/changeMode.d.ts +4 -1
- package/dist/shared-utils/getPxmm.d.ts +8 -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/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 +17 -27
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +21 -41
- package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +16 -36
- 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/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 +70 -78
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +434 -274
- 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/{typings/events.type.js → typing.js} +0 -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/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/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,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
|
|
6
|
+
export class Controller extends BasePlugin.Controller {
|
|
4
7
|
constructor(five, params) {
|
|
5
|
-
|
|
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:
|
|
14
|
+
value: 'panoFloorplanRadarPlugin'
|
|
10
15
|
});
|
|
11
|
-
Object.defineProperty(this, "
|
|
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
|
-
|
|
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
|
-
|
|
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, "
|
|
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, "
|
|
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, "
|
|
73
|
+
Object.defineProperty(this, "_disable", {
|
|
57
74
|
enumerable: true,
|
|
58
75
|
configurable: true,
|
|
59
76
|
writable: true,
|
|
60
|
-
value:
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
this.
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
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(
|
|
96
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
3
|
-
export declare const PanoFloorplanRadarPlugin: FivePlugin<
|
|
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
|
|
1
|
+
import { Controller } from './Controller';
|
|
2
2
|
export const PanoFloorplanRadarPlugin = (five, params) => {
|
|
3
|
-
return new
|
|
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 {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
11
|
+
private selector?;
|
|
42
12
|
private panoIndex;
|
|
43
13
|
private floorIndex;
|
|
44
|
-
|
|
45
|
-
private lastPanoramaLongitude;
|
|
46
|
-
private selector?;
|
|
47
|
-
private floorplanData?;
|
|
14
|
+
/** 户型图父容器 */
|
|
48
15
|
private wrapper?;
|
|
16
|
+
/** 户型图主容器 */
|
|
49
17
|
private container;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
private
|
|
60
|
-
private
|
|
61
|
-
private
|
|
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
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
private
|
|
60
|
+
private onModelShownFloorChange;
|
|
61
|
+
/** 如果用户是通过 selector 设置父容器,需要在 modelLoaded 之后把 container 自动放到父容器里
|
|
62
|
+
*
|
|
63
|
+
* - TODO: 等 selector 功能下掉之后删除这个逻辑
|
|
64
|
+
*/
|
|
65
|
+
private initContainer;
|
|
73
66
|
private render;
|
|
74
67
|
}
|
|
75
|
-
export {};
|