@realsee/dnalogel 2.0.0-alpha.10 → 2.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CSS3DRenderPlugin/index.js +17 -14
- package/dist/CameraMovementPlugin/index.js +40 -15
- package/dist/ModelChassisCompassPlugin/index.js +32 -6
- package/dist/ModelEntryDoorGuidePlugin/index.js +48 -18
- package/dist/ModelItemLabelPlugin/events.type.d.ts +9 -0
- package/dist/ModelItemLabelPlugin/index.d.ts +4 -0
- package/dist/ModelItemLabelPlugin/index.js +679 -0
- package/dist/ModelItemLabelPlugin/typings.d.ts +55 -0
- package/dist/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/dist/ModelRoomLabelPlugin/index.js +71 -28
- package/dist/PanoCompassPlugin/index.js +311 -164
- package/dist/PanoCursorRaycasterPlugin/index.js +5 -3
- package/dist/PanoMeasurePlugin/index.js +1337 -583
- package/dist/PanoRulerPlugin/index.js +32 -5
- package/dist/PanoSpatialTagPlugin/index.js +73 -38
- package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +1 -0
- package/dist/floorplan/ModelFloorplanPlugin/index.js +678 -439
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
- package/dist/floorplan/TopviewFloorplanPlugin/Controller.d.ts +1 -0
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +403 -230
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +3596 -1612
- package/dist/index.js +3602 -1616
- package/dist/index.umd.js +3605 -1620
- package/docs/assets/main.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/ModelRoomLabelController.html +6 -6
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ModelFloorplanErrorType.html +1 -1
- package/docs/index.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/ModelFloorplanParameterType.html +1 -1
- package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
- package/docs/modules.html +12 -12
- package/libs/CSS3DRenderPlugin/index.js +16 -13
- package/libs/CameraMovementPlugin/index.js +24 -15
- package/libs/ModelChassisCompassPlugin/index.js +14 -5
- package/libs/ModelEntryDoorGuidePlugin/index.js +24 -12
- package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +422 -0
- package/libs/ModelItemLabelPlugin/ItemLabelItem.js +133 -0
- package/libs/ModelItemLabelPlugin/events.type.d.ts +9 -0
- package/libs/ModelItemLabelPlugin/events.type.js +1 -0
- package/libs/ModelItemLabelPlugin/index.d.ts +4 -0
- package/libs/ModelItemLabelPlugin/index.js +172 -0
- package/libs/ModelItemLabelPlugin/typings.d.ts +55 -0
- package/libs/ModelItemLabelPlugin/typings.js +6 -0
- package/libs/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/libs/ModelItemLabelPlugin/utils/parseData.js +4 -0
- package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
- package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +7 -5
- package/libs/PanoCompassPlugin/index.js +225 -128
- package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
- package/libs/PanoMeasurePlugin/Controller/BaseController.js +68 -13
- package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
- package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +234 -152
- package/libs/PanoMeasurePlugin/Controller/index.js +131 -47
- package/libs/PanoMeasurePlugin/Model/index.js +30 -5
- package/libs/PanoMeasurePlugin/Model/line.js +60 -10
- package/libs/PanoMeasurePlugin/Model/point.js +24 -4
- package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +59 -14
- package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
- package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
- package/libs/PanoMeasurePlugin/Modules/Magnifier.js +60 -10
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +83 -37
- package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +61 -30
- package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -2
- package/libs/PanoMeasurePlugin/utils/line.js +8 -7
- package/libs/PanoRulerPlugin/index.js +16 -5
- package/libs/PanoSpatialTagPlugin/Components/tag.js +9 -9
- package/libs/PanoSpatialTagPlugin/index.js +11 -9
- package/libs/floorplan/Components/BaseImage.js +10 -5
- package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -1
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +5 -6
- package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +24 -11
- package/libs/floorplan/ModelFloorplanPlugin/Components/Main.js +77 -69
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
- package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +1 -0
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +457 -273
- package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +33 -22
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +3 -1
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +97 -36
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.d.ts +1 -0
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +232 -108
- package/libs/floorplan/utils/formatData.js +43 -28
- package/libs/floorplan/utils/formatPosition.js +1 -1
- package/libs/index.d.ts +1 -0
- package/libs/index.js +2 -0
- package/libs/shared-utils/Subscribe.js +8 -1
- package/libs/shared-utils/animationFrame/BetterTween.js +47 -18
- package/libs/shared-utils/createCanvasTextTexture.js +6 -5
- package/libs/shared-utils/five/changeMode.js +23 -12
- package/libs/shared-utils/getPxmm.js +1 -1
- package/libs/shared-utils/math/evenNumber.js +1 -1
- package/libs/shared-utils/three/loadFbxObj.js +20 -9
- package/libs/shared-utils/three/loadTexture.js +17 -6
- package/libs/shared-utils/three/transfromToMeshBasicMaterial.js +2 -1
- package/libs/shared-utils/tinyEJSrender.js +36 -6
- package/libs/shared-utils/to.js +21 -10
- package/libs/shared-utils/useDebounce.js +1 -1
- package/libs/shared-utils/useThrottle.js +2 -1
- package/package.json +2 -2
- package/CHANGELOG.md +0 -34
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Five, Subscribe } from "@realsee/five";
|
|
2
|
+
import ItemLabelComponent from './ItemLabelComponent';
|
|
3
|
+
import { DISPLAY_STRATEGY_TYPE } from "./typings";
|
|
4
|
+
import { parseModelItemLabelPluginData } from "./utils/parseData";
|
|
5
|
+
export const ModelItemLabelPlugin = (five, params) => {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const pluginState = {
|
|
8
|
+
container: document.createElement('div'),
|
|
9
|
+
data: null,
|
|
10
|
+
enabled: true,
|
|
11
|
+
fiveModeEnabled: undefined,
|
|
12
|
+
itemLabels: [],
|
|
13
|
+
wrapper: null,
|
|
14
|
+
app: undefined,
|
|
15
|
+
hooks: new Subscribe(),
|
|
16
|
+
modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
|
|
17
|
+
displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : DISPLAY_STRATEGY_TYPE.SMALL
|
|
18
|
+
};
|
|
19
|
+
pluginState.container.setAttribute('class', 'model-item-label-plugin-container');
|
|
20
|
+
pluginState.container.style.cssText = `
|
|
21
|
+
position: absolute;
|
|
22
|
+
left: 0;
|
|
23
|
+
top: 0;
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 100%;
|
|
26
|
+
pointerEvents: none;
|
|
27
|
+
`;
|
|
28
|
+
const appendTo = (wrapper) => {
|
|
29
|
+
pluginState.wrapper = wrapper;
|
|
30
|
+
wrapper.appendChild(pluginState.container);
|
|
31
|
+
render();
|
|
32
|
+
return true;
|
|
33
|
+
};
|
|
34
|
+
const load = (data) => {
|
|
35
|
+
console.log('🐶--当前标签总条数: ', data.model_item_labels.length);
|
|
36
|
+
pluginState.itemLabels = parseModelItemLabelPluginData(data);
|
|
37
|
+
render();
|
|
38
|
+
};
|
|
39
|
+
const enable = () => {
|
|
40
|
+
if (pluginState.enabled)
|
|
41
|
+
return true;
|
|
42
|
+
pluginState.enabled = true;
|
|
43
|
+
render();
|
|
44
|
+
return true;
|
|
45
|
+
};
|
|
46
|
+
const disable = () => {
|
|
47
|
+
if (!pluginState.enabled)
|
|
48
|
+
return true;
|
|
49
|
+
pluginState.enabled = false;
|
|
50
|
+
render();
|
|
51
|
+
return true;
|
|
52
|
+
};
|
|
53
|
+
const dispose = () => {
|
|
54
|
+
removeListener4Five();
|
|
55
|
+
pluginState.container.remove();
|
|
56
|
+
};
|
|
57
|
+
const handleRerender = () => {
|
|
58
|
+
if (!pluginState.enabled || !pluginState.fiveModeEnabled)
|
|
59
|
+
return;
|
|
60
|
+
disable();
|
|
61
|
+
};
|
|
62
|
+
const rerender = (a, b, c) => {
|
|
63
|
+
if (!pluginState.fiveModeEnabled)
|
|
64
|
+
return;
|
|
65
|
+
if (!c)
|
|
66
|
+
return;
|
|
67
|
+
enable();
|
|
68
|
+
render();
|
|
69
|
+
};
|
|
70
|
+
const handleInteriaPanRerender = (a, b) => {
|
|
71
|
+
if (!pluginState.fiveModeEnabled)
|
|
72
|
+
return;
|
|
73
|
+
if (!b)
|
|
74
|
+
return;
|
|
75
|
+
enable();
|
|
76
|
+
render();
|
|
77
|
+
};
|
|
78
|
+
const handleWantsPanGesture = (pose, final) => {
|
|
79
|
+
if (pose) {
|
|
80
|
+
handleRerender();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const handlePanGesture = (pose, final) => {
|
|
84
|
+
if (!pluginState.fiveModeEnabled)
|
|
85
|
+
return;
|
|
86
|
+
if (!final)
|
|
87
|
+
return;
|
|
88
|
+
enable();
|
|
89
|
+
render();
|
|
90
|
+
};
|
|
91
|
+
const render = () => {
|
|
92
|
+
var _a;
|
|
93
|
+
if (!pluginState.wrapper)
|
|
94
|
+
return;
|
|
95
|
+
// 只要不可展示,销毁容器
|
|
96
|
+
if (!pluginState.enabled || !pluginState.fiveModeEnabled) {
|
|
97
|
+
(_a = pluginState.app) === null || _a === void 0 ? void 0 : _a.$destroy();
|
|
98
|
+
pluginState.app = undefined;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
// 正常显示时,分为 app 存在和不存在两种情况,如果存在,传值,不存在则初始化并传值
|
|
102
|
+
if (!pluginState.app) {
|
|
103
|
+
pluginState.app = new ItemLabelComponent({
|
|
104
|
+
target: pluginState.container,
|
|
105
|
+
props: {
|
|
106
|
+
five: five,
|
|
107
|
+
modelOcclusionEnable: pluginState.modelOcclusionEnable,
|
|
108
|
+
itemLabels: pluginState.itemLabels,
|
|
109
|
+
wrapper: pluginState.wrapper,
|
|
110
|
+
hooks: pluginState.hooks,
|
|
111
|
+
displayStrategyType: pluginState.displayStrategyType
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
pluginState.app.$set({
|
|
117
|
+
five: five,
|
|
118
|
+
itemLabels: pluginState.itemLabels
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
// 添加 five 监听
|
|
123
|
+
const addListener4Five = () => {
|
|
124
|
+
five.on('modeChange', onFiveModeChange);
|
|
125
|
+
five.once('dispose', dispose);
|
|
126
|
+
// five.on('wantsGesture', handleRerender)
|
|
127
|
+
// five.on('gesture', rerender)
|
|
128
|
+
five.on('wantsMouseWheel', handleRerender);
|
|
129
|
+
five.on('mouseWheel', rerender);
|
|
130
|
+
five.on('wantsInteriaPan', handleRerender);
|
|
131
|
+
five.on('interiaPan', handleInteriaPanRerender);
|
|
132
|
+
five.on('wantsPanGesture', handleWantsPanGesture);
|
|
133
|
+
five.on('panGesture', handlePanGesture);
|
|
134
|
+
five.on('wantsPinchGesture', handleRerender);
|
|
135
|
+
five.on('pinchGesture', rerender);
|
|
136
|
+
};
|
|
137
|
+
// 取消 five 监听
|
|
138
|
+
const removeListener4Five = () => {
|
|
139
|
+
five.off('modeChange', onFiveModeChange);
|
|
140
|
+
// five.off('wantsGesture', handleRerender)
|
|
141
|
+
// five.off('gesture', rerender)
|
|
142
|
+
five.off('wantsMouseWheel', handleRerender);
|
|
143
|
+
five.off('mouseWheel', rerender);
|
|
144
|
+
five.off('wantsInteriaPan', handleRerender);
|
|
145
|
+
five.off('interiaPan', handleInteriaPanRerender);
|
|
146
|
+
five.off('wantsPanGesture', handleWantsPanGesture);
|
|
147
|
+
five.off('panGesture', handlePanGesture);
|
|
148
|
+
five.off('wantsPinchGesture', handleRerender);
|
|
149
|
+
five.off('pinchGesture', rerender);
|
|
150
|
+
};
|
|
151
|
+
const onFiveModeChange = (mode) => {
|
|
152
|
+
if (mode !== Five.Mode.Floorplan) {
|
|
153
|
+
pluginState.fiveModeEnabled = false;
|
|
154
|
+
render();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
five.once('initAnimationEnded', () => {
|
|
158
|
+
pluginState.fiveModeEnabled = five.currentMode === Five.Mode.Floorplan;
|
|
159
|
+
render();
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
addListener4Five();
|
|
163
|
+
return {
|
|
164
|
+
appendTo,
|
|
165
|
+
load,
|
|
166
|
+
enable,
|
|
167
|
+
disable,
|
|
168
|
+
dispose,
|
|
169
|
+
hooks: pluginState.hooks
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
export default ModelItemLabelPlugin;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import ItemLabelComponent from './ItemLabelComponent';
|
|
2
|
+
import type { Subscribe } from "@realsee/five";
|
|
3
|
+
import { PluginEvent } from "./events.type";
|
|
4
|
+
export declare enum DISPLAY_STRATEGY_TYPE {
|
|
5
|
+
SMALL = "small",
|
|
6
|
+
MIDLLE = "middle",
|
|
7
|
+
LARGE = "large"
|
|
8
|
+
}
|
|
9
|
+
export interface ModelItemLabelPluginParametersType {
|
|
10
|
+
modelOcclusionEnable?: boolean;
|
|
11
|
+
displayStrategyType?: Partial<DISPLAY_STRATEGY_TYPE>;
|
|
12
|
+
}
|
|
13
|
+
export interface ModelItemLabelPluginData {
|
|
14
|
+
model_item_labels: Readonly<{
|
|
15
|
+
id: string;
|
|
16
|
+
library: string;
|
|
17
|
+
name: string;
|
|
18
|
+
size: [number, number, number];
|
|
19
|
+
center: [number, number, number];
|
|
20
|
+
position: [number, number, number];
|
|
21
|
+
type: string[];
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}>[];
|
|
24
|
+
}
|
|
25
|
+
export interface ItemLabel {
|
|
26
|
+
id: string;
|
|
27
|
+
library: string;
|
|
28
|
+
name: string;
|
|
29
|
+
size: [number, number, number];
|
|
30
|
+
center: [number, number, number];
|
|
31
|
+
position: [number, number, number];
|
|
32
|
+
type: string[];
|
|
33
|
+
modelPosition: [number, number, number];
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}
|
|
36
|
+
export interface ModelItemLabelPluginExportReturnsType {
|
|
37
|
+
appendTo: (wrapper: Element) => void;
|
|
38
|
+
load: (data: ModelItemLabelPluginData) => void;
|
|
39
|
+
disable: () => void;
|
|
40
|
+
enable: () => void;
|
|
41
|
+
dispose: () => void;
|
|
42
|
+
hooks: Subscribe<PluginEvent>;
|
|
43
|
+
}
|
|
44
|
+
export interface ModelItemLabelPluginState {
|
|
45
|
+
container: HTMLDivElement;
|
|
46
|
+
data: ModelItemLabelPluginData | null;
|
|
47
|
+
enabled: boolean;
|
|
48
|
+
itemLabels: ItemLabel[];
|
|
49
|
+
wrapper: HTMLElement | null;
|
|
50
|
+
fiveModeEnabled: boolean;
|
|
51
|
+
app?: ItemLabelComponent | undefined;
|
|
52
|
+
hooks: Subscribe<PluginEvent>;
|
|
53
|
+
modelOcclusionEnable: boolean;
|
|
54
|
+
displayStrategyType: Partial<DISPLAY_STRATEGY_TYPE>;
|
|
55
|
+
}
|
|
@@ -1,14 +1,69 @@
|
|
|
1
1
|
import RoomLabelItems from './RoomLabelItems';
|
|
2
2
|
import { parseModelRoomLabelPluginData } from './utils/parseData';
|
|
3
3
|
export class ModelRoomLabelController {
|
|
4
|
-
five;
|
|
5
|
-
enabled = true;
|
|
6
|
-
fiveModeEnabled;
|
|
7
|
-
app = undefined;
|
|
8
|
-
wrapper;
|
|
9
|
-
roomLabels = [];
|
|
10
|
-
container = document.createElement('div');
|
|
11
4
|
constructor(five) {
|
|
5
|
+
Object.defineProperty(this, "five", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true,
|
|
9
|
+
value: void 0
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(this, "enabled", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
configurable: true,
|
|
14
|
+
writable: true,
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(this, "fiveModeEnabled", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: void 0
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(this, "app", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true,
|
|
27
|
+
value: undefined
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(this, "wrapper", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
writable: true,
|
|
33
|
+
value: void 0
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(this, "roomLabels", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true,
|
|
39
|
+
value: []
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(this, "container", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true,
|
|
45
|
+
value: document.createElement('div')
|
|
46
|
+
});
|
|
47
|
+
/** 监听 Five Mode 变化
|
|
48
|
+
* @description
|
|
49
|
+
* Mode 不符合要求时,立刻消失,满足要求时,需要等待动画结束再展示
|
|
50
|
+
*/
|
|
51
|
+
Object.defineProperty(this, "onFiveModeChange", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
configurable: true,
|
|
54
|
+
writable: true,
|
|
55
|
+
value: (mode) => {
|
|
56
|
+
if (mode !== 'Floorplan') {
|
|
57
|
+
this.fiveModeEnabled = false;
|
|
58
|
+
this.render();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
this.five.once('initAnimationEnded', () => {
|
|
62
|
+
this.fiveModeEnabled = this.five.currentMode === 'Floorplan';
|
|
63
|
+
this.render();
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
12
67
|
this.five = five;
|
|
13
68
|
this.fiveModeEnabled = this.five.currentMode === 'Floorplan';
|
|
14
69
|
// init container style
|
|
@@ -61,26 +116,12 @@ export class ModelRoomLabelController {
|
|
|
61
116
|
this.render();
|
|
62
117
|
return this;
|
|
63
118
|
}
|
|
64
|
-
/** 监听 Five Mode 变化
|
|
65
|
-
* @description
|
|
66
|
-
* Mode 不符合要求时,立刻消失,满足要求时,需要等待动画结束再展示
|
|
67
|
-
*/
|
|
68
|
-
onFiveModeChange = (mode) => {
|
|
69
|
-
if (mode !== 'Floorplan') {
|
|
70
|
-
this.fiveModeEnabled = false;
|
|
71
|
-
this.render();
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
this.five.once('initAnimationEnded', () => {
|
|
75
|
-
this.fiveModeEnabled = this.five.currentMode === 'Floorplan';
|
|
76
|
-
this.render();
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
119
|
render() {
|
|
120
|
+
var _a;
|
|
80
121
|
if (!this.wrapper)
|
|
81
122
|
return;
|
|
82
123
|
if (!this.enabled || !this.fiveModeEnabled) {
|
|
83
|
-
this.app
|
|
124
|
+
(_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
|
|
84
125
|
this.app = undefined;
|
|
85
126
|
return;
|
|
86
127
|
}
|
|
@@ -36,7 +36,7 @@ function get_each_context(ctx, list, i) {
|
|
|
36
36
|
return child_ctx;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
// (
|
|
39
|
+
// (70:2) {#each roomLabels as roomLableItem (roomLableItem.id)}
|
|
40
40
|
function create_each_block(key_1, ctx) {
|
|
41
41
|
let first;
|
|
42
42
|
let roomlabelitem;
|
|
@@ -191,15 +191,15 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
191
191
|
|
|
192
192
|
function getFormatedRoomLabels(five, labels) {
|
|
193
193
|
const newLabels = labels.map(roomLabelItem => {
|
|
194
|
-
//
|
|
194
|
+
// 计算是否可见,如果不可见,不会更新位置
|
|
195
195
|
const visible = getLabelVisible(five, roomLabelItem);
|
|
196
196
|
|
|
197
|
-
if (!visible) return {
|
|
197
|
+
if (!visible) return Object.assign(Object.assign({}, roomLabelItem), { visible });
|
|
198
198
|
|
|
199
199
|
// 更新位置
|
|
200
200
|
const transform = getLabelTransform(five, roomLabelItem);
|
|
201
201
|
|
|
202
|
-
return {
|
|
202
|
+
return Object.assign(Object.assign({}, roomLabelItem), { visible, transform });
|
|
203
203
|
});
|
|
204
204
|
|
|
205
205
|
const sortedRoomLabelItems = newLabels.filter(({ visible }) => visible).map(roomLabelItem => ({
|
|
@@ -209,7 +209,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
209
209
|
|
|
210
210
|
return newLabels.map(roomLabelItem => {
|
|
211
211
|
const sortIndex = sortedRoomLabelItems.findIndex(item => item.roomLabelItem.id === roomLabelItem.id);
|
|
212
|
-
if (sortIndex !== undefined) return {
|
|
212
|
+
if (sortIndex !== undefined) return Object.assign(Object.assign({}, roomLabelItem), { zIndex: sortIndex * 10 });
|
|
213
213
|
return roomLabelItem;
|
|
214
214
|
});
|
|
215
215
|
}
|
|
@@ -219,9 +219,11 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
five.on('cameraUpdate', onFiveCameraUpdate);
|
|
222
|
+
five.on('modelShownFloorChange', onFiveCameraUpdate);
|
|
222
223
|
|
|
223
224
|
onDestroy(() => {
|
|
224
225
|
five.off('cameraUpdate', onFiveCameraUpdate);
|
|
226
|
+
five.off('modelShownFloorChange', onFiveCameraUpdate);
|
|
225
227
|
});
|
|
226
228
|
|
|
227
229
|
onMount(() => {
|