@realsee/dnalogel 2.0.0-alpha.18 → 2.0.0-alpha.20
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/CHANGELOG.md +10 -0
- package/dist/CSS3DRenderPlugin/index.d.ts +2 -2
- package/dist/CameraMovementPlugin/index.js +15 -40
- package/dist/CameraMovementPlugin/typing.d.ts +1 -1
- package/dist/ModelChassisCompassPlugin/index.js +3 -28
- package/dist/ModelEntryDoorGuidePlugin/index.d.ts +1 -1
- package/dist/ModelEntryDoorGuidePlugin/index.js +8 -33
- package/dist/ModelItemLabelPlugin/events.type.d.ts +2 -2
- package/dist/ModelItemLabelPlugin/typings.d.ts +2 -2
- package/dist/ModelItemLabelPlugin/utils/parseData.d.ts +1 -1
- package/dist/ModelRoomLabelPlugin/utils/parseData.d.ts +1 -1
- package/dist/ModelTVVideoPlugin/index.d.ts +1 -1
- package/dist/ModelTVVideoPlugin/index.js +3 -28
- package/dist/PanoCompassPlugin/index.js +53 -86
- package/dist/PanoCursorRaycasterPlugin/index.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Controller/BaseController.d.ts +8 -8
- package/dist/PanoMeasurePlugin/Controller/EditController.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Controller/ShortcutKeyController.d.ts +2 -2
- package/dist/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Controller/index.d.ts +3 -3
- package/dist/PanoMeasurePlugin/Model/index.d.ts +2 -2
- package/dist/PanoMeasurePlugin/Model/line.d.ts +5 -5
- package/dist/PanoMeasurePlugin/Model/point.d.ts +2 -2
- package/dist/PanoMeasurePlugin/Model/polyline.d.ts +3 -3
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +2 -2
- package/dist/PanoMeasurePlugin/Modules/FiveHelper.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/GuideController.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/Magnifier.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/UIController/Revoke/index.d.ts +2 -1
- package/dist/PanoMeasurePlugin/Modules/UIController/index.d.ts +1 -1
- package/dist/PanoMeasurePlugin/index.d.ts +1 -1
- package/dist/PanoMeasurePlugin/index.js +2 -0
- package/dist/PanoMeasurePlugin/typings/event.type.d.ts +4 -4
- package/dist/PanoMeasurePlugin/utils/clearGroup.d.ts +1 -1
- package/dist/PanoMeasurePlugin/utils/constants.d.ts +1 -1
- package/dist/PanoMeasurePlugin/utils/distanceDom.d.ts +3 -3
- package/dist/PanoMeasurePlugin/utils/findAssociatedLines.d.ts +1 -1
- package/dist/PanoMeasurePlugin/utils/findClosestPoint.d.ts +3 -3
- package/dist/PanoMeasurePlugin/utils/getIntersectionFromEvent.d.ts +2 -2
- package/dist/PanoMeasurePlugin/utils/getPointFromHammerEvent.d.ts +1 -1
- package/dist/PanoMeasurePlugin/utils/isNDCPointInScreen.d.ts +1 -1
- package/dist/PanoMeasurePlugin/utils/line.d.ts +1 -1
- package/dist/PanoRulerPlugin/index.d.ts +1 -1
- package/dist/PanoRulerPlugin/index.js +3 -28
- package/dist/PanoSpatialTagPlugin/typings.d.ts +1 -1
- package/dist/floorplan/{ModelFloorplanPlugin/Assets → Assets}/compass.d.ts +0 -0
- package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +2 -2
- package/dist/floorplan/ModelFloorplanPlugin/index.js +1253 -1284
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +61 -183
- package/dist/floorplan/TopviewFloorplanPlugin/Controller.d.ts +28 -15
- package/dist/floorplan/TopviewFloorplanPlugin/index.d.ts +1 -1
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +1243 -1235
- package/dist/floorplan/utils/formatPosition.d.ts +1 -1
- package/dist/index.es.js +1431 -1435
- package/dist/index.js +1430 -1434
- package/dist/index.umd.js +1430 -1434
- package/dist/shared-utils/three/getExtraModelLoader.d.ts +1 -1
- package/dist/shared-utils/three/getNormal.d.ts +1 -1
- package/dist/shared-utils/three/getTextureLoader.d.ts +1 -1
- package/dist/shared-utils/three/loadFbxObj.d.ts +1 -1
- package/dist/shared-utils/vectorTocoordinates.d.ts +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/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/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/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 +19 -1
- package/docs/modules.html +12 -12
- package/libs/CSS3DRenderPlugin/index.d.ts +2 -2
- package/libs/CameraMovementPlugin/index.js +15 -24
- package/libs/CameraMovementPlugin/typing.d.ts +1 -1
- package/libs/ModelChassisCompassPlugin/index.js +3 -12
- package/libs/ModelEntryDoorGuidePlugin/index.d.ts +1 -1
- package/libs/ModelEntryDoorGuidePlugin/index.js +8 -17
- package/libs/ModelItemLabelPlugin/events.type.d.ts +2 -2
- package/libs/ModelItemLabelPlugin/typings.d.ts +2 -2
- package/libs/ModelItemLabelPlugin/utils/parseData.d.ts +1 -1
- package/libs/ModelRoomLabelPlugin/utils/parseData.d.ts +1 -1
- package/libs/ModelTVVideoPlugin/index.d.ts +1 -1
- package/libs/ModelTVVideoPlugin/index.js +3 -12
- package/libs/ModelTVVideoPlugin/typings.js +1 -0
- package/libs/PanoCompassPlugin/index.js +49 -64
- package/libs/PanoCursorRaycasterPlugin/index.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Controller/BaseController.d.ts +8 -8
- package/libs/PanoMeasurePlugin/Controller/EditController.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.d.ts +2 -2
- package/libs/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Controller/index.d.ts +3 -3
- package/libs/PanoMeasurePlugin/Model/index.d.ts +2 -2
- package/libs/PanoMeasurePlugin/Model/line.d.ts +5 -5
- package/libs/PanoMeasurePlugin/Model/line.js +1 -1
- package/libs/PanoMeasurePlugin/Model/point.d.ts +2 -2
- package/libs/PanoMeasurePlugin/Model/polyline.d.ts +3 -3
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +2 -2
- package/libs/PanoMeasurePlugin/Modules/FiveHelper.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/GuideController.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/Magnifier.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.d.ts +2 -1
- package/libs/PanoMeasurePlugin/Modules/UIController/index.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +2 -0
- package/libs/PanoMeasurePlugin/index.d.ts +1 -1
- package/libs/PanoMeasurePlugin/typings/event.type.d.ts +4 -4
- package/libs/PanoMeasurePlugin/utils/clearGroup.d.ts +1 -1
- package/libs/PanoMeasurePlugin/utils/constants.d.ts +1 -1
- package/libs/PanoMeasurePlugin/utils/distanceDom.d.ts +3 -3
- package/libs/PanoMeasurePlugin/utils/findAssociatedLines.d.ts +1 -1
- package/libs/PanoMeasurePlugin/utils/findClosestPoint.d.ts +3 -3
- package/libs/PanoMeasurePlugin/utils/getIntersectionFromEvent.d.ts +2 -2
- package/libs/PanoMeasurePlugin/utils/getPointFromHammerEvent.d.ts +1 -1
- package/libs/PanoMeasurePlugin/utils/isNDCPointInScreen.d.ts +1 -1
- package/libs/PanoMeasurePlugin/utils/line.d.ts +1 -1
- package/libs/PanoMeasurePlugin/utils/mouseGroup.js +1 -0
- package/libs/PanoRulerPlugin/index.d.ts +1 -1
- package/libs/PanoRulerPlugin/index.js +3 -12
- package/libs/PanoSpatialTagPlugin/typings.d.ts +1 -1
- package/libs/floorplan/{ModelFloorplanPlugin/Assets → Assets}/compass.d.ts +0 -0
- package/libs/floorplan/{ModelFloorplanPlugin/Assets → Assets}/compass.js +0 -0
- package/libs/floorplan/{ModelFloorplanPlugin/Components → Components}/Camera.js +2 -2
- package/libs/floorplan/{ModelFloorplanPlugin/Components → Components}/Compass.js +0 -0
- package/libs/floorplan/{ModelFloorplanPlugin/Components/CurrentFloor → Components}/CurrentFloor.js +73 -80
- package/libs/floorplan/{ModelFloorplanPlugin/Components → Components}/Main.js +186 -105
- package/libs/floorplan/Components/RoomHighlight/Room.js +5 -7
- package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +24 -116
- package/libs/floorplan/{ModelFloorplanPlugin/Components → Components}/RoomLabels/RoomLabel.js +0 -0
- package/libs/floorplan/{ModelFloorplanPlugin/Components → Components}/RoomLabels/RoomLabels.js +2 -2
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +26 -22
- package/libs/floorplan/Components/RuleLabels/RuleItem.js +284 -0
- package/libs/floorplan/{ModelFloorplanPlugin/Components → Components}/RuleLabels/RuleLabels.js +82 -32
- package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +2 -2
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +34 -43
- package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +22 -33
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +3 -12
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.d.ts +28 -15
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +80 -54
- package/libs/floorplan/TopviewFloorplanPlugin/index.d.ts +1 -1
- package/libs/floorplan/TopviewFloorplanPlugin/style.js +0 -1
- package/libs/floorplan/utils/formatData.js +28 -43
- package/libs/floorplan/utils/formatPosition.d.ts +1 -1
- package/libs/floorplan/utils/formatPosition.js +2 -2
- package/libs/shared-utils/five/changeMode.js +12 -23
- package/libs/shared-utils/three/getExtraModelLoader.d.ts +1 -1
- package/libs/shared-utils/three/getNormal.d.ts +1 -1
- package/libs/shared-utils/three/getTextureLoader.d.ts +1 -1
- package/libs/shared-utils/three/loadFbxObj.d.ts +1 -1
- package/libs/shared-utils/three/loadFbxObj.js +9 -20
- package/libs/shared-utils/three/loadTexture.js +6 -17
- package/libs/shared-utils/to.js +10 -21
- package/libs/shared-utils/vectorTocoordinates.d.ts +1 -1
- package/package.json +2 -2
- package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleItem.js +0 -301
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
1
|
+
import * as THREE from 'three';
|
|
10
2
|
import { pluginStyle } from './style';
|
|
11
3
|
import formatData from '../utils/formatData';
|
|
12
|
-
import { omit } from '../../shared-utils/filter';
|
|
13
4
|
import getPxmm from '../../shared-utils/getPxmm';
|
|
14
|
-
import
|
|
5
|
+
import { omit } from '../../shared-utils/filter';
|
|
6
|
+
import Main from '../Components/Main';
|
|
15
7
|
import changeModelCanvasOpacity from '../../shared-utils/changeModelCanvasOpacity';
|
|
16
8
|
export class TopviewFloorplanPluginController {
|
|
17
9
|
constructor(five, params) {
|
|
@@ -100,32 +92,58 @@ export class TopviewFloorplanPluginController {
|
|
|
100
92
|
value: () => {
|
|
101
93
|
var _a, _b;
|
|
102
94
|
this.hide();
|
|
103
|
-
(_a = this.
|
|
104
|
-
(_b = this.
|
|
105
|
-
this.five.off('modeChange', this.
|
|
106
|
-
this.five.off('
|
|
107
|
-
this.five.off('
|
|
108
|
-
this.five.off('
|
|
109
|
-
this.five.off('
|
|
110
|
-
this.five.off('
|
|
95
|
+
(_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
|
|
96
|
+
(_b = this.container) === null || _b === void 0 ? void 0 : _b.remove();
|
|
97
|
+
this.five.off('modeChange', this.onFiveModeChange);
|
|
98
|
+
this.five.off('panGesture', this.onFivePanGesture);
|
|
99
|
+
this.five.off('panoArrived', this.onFivePanoArrived);
|
|
100
|
+
this.five.off('modelLoaded', this.onFiveModelLoaded);
|
|
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);
|
|
111
105
|
this.five.off('modelShownFloorChange', this.onModelShownFloorChange);
|
|
112
106
|
}
|
|
113
107
|
});
|
|
114
|
-
|
|
108
|
+
Object.defineProperty(this, "onFiveWantsMoveToPano", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
configurable: true,
|
|
111
|
+
writable: true,
|
|
112
|
+
value: () => {
|
|
113
|
+
if (this.visible && this.configs.preventRoomClick)
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
Object.defineProperty(this, "onFiveWantsGesture", {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
configurable: true,
|
|
120
|
+
writable: true,
|
|
121
|
+
value: (type) => {
|
|
122
|
+
if (type !== 'pan' && type !== 'pinch' && type !== 'mouseWheel')
|
|
123
|
+
return;
|
|
124
|
+
if (this.visible && !this.configs.gestureEnable)
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
115
128
|
Object.defineProperty(this, "onModelShownFloorChange", {
|
|
116
129
|
enumerable: true,
|
|
117
130
|
configurable: true,
|
|
118
131
|
writable: true,
|
|
119
132
|
value: (shownFloor) => {
|
|
120
|
-
if (
|
|
133
|
+
if (this.floorIndex === shownFloor)
|
|
121
134
|
return;
|
|
135
|
+
if (shownFloor === null) {
|
|
136
|
+
const panoIndex = this.five.getCurrentState().panoIndex;
|
|
137
|
+
this.floorIndex = this.five.work.observers[panoIndex].floorIndex;
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
// 模型楼层高亮改变时,自动进行楼层切换
|
|
122
141
|
this.floorIndex = shownFloor;
|
|
123
142
|
this.updateSize();
|
|
124
143
|
this.render();
|
|
125
144
|
}
|
|
126
145
|
});
|
|
127
|
-
|
|
128
|
-
Object.defineProperty(this, "handlePanoArrived", {
|
|
146
|
+
Object.defineProperty(this, "onFivePanoArrived", {
|
|
129
147
|
enumerable: true,
|
|
130
148
|
configurable: true,
|
|
131
149
|
writable: true,
|
|
@@ -137,31 +155,28 @@ export class TopviewFloorplanPluginController {
|
|
|
137
155
|
this.floorIndex = this.five.work.observers[index].floorIndex;
|
|
138
156
|
}
|
|
139
157
|
});
|
|
140
|
-
|
|
141
|
-
Object.defineProperty(this, "handleWantsMoveToPano", {
|
|
158
|
+
Object.defineProperty(this, "onFivePanGesture", {
|
|
142
159
|
enumerable: true,
|
|
143
160
|
configurable: true,
|
|
144
161
|
writable: true,
|
|
145
162
|
value: () => {
|
|
146
163
|
if (!this.visible)
|
|
147
164
|
return;
|
|
148
|
-
|
|
149
|
-
return false;
|
|
150
|
-
return;
|
|
165
|
+
this.updatePosition();
|
|
151
166
|
}
|
|
152
167
|
});
|
|
153
|
-
|
|
154
|
-
Object.defineProperty(this, "handleWantsPanGesture", {
|
|
168
|
+
Object.defineProperty(this, "onFivePinchGesture", {
|
|
155
169
|
enumerable: true,
|
|
156
170
|
configurable: true,
|
|
157
171
|
writable: true,
|
|
158
172
|
value: () => {
|
|
159
173
|
if (!this.visible)
|
|
160
174
|
return;
|
|
161
|
-
|
|
175
|
+
this.updatePosition();
|
|
176
|
+
this.updateSize();
|
|
162
177
|
}
|
|
163
178
|
});
|
|
164
|
-
Object.defineProperty(this, "
|
|
179
|
+
Object.defineProperty(this, "onFiveModelLoaded", {
|
|
165
180
|
enumerable: true,
|
|
166
181
|
configurable: true,
|
|
167
182
|
writable: true,
|
|
@@ -178,7 +193,7 @@ export class TopviewFloorplanPluginController {
|
|
|
178
193
|
}
|
|
179
194
|
});
|
|
180
195
|
/** 非 Topview 态隐藏户型图 */
|
|
181
|
-
Object.defineProperty(this, "
|
|
196
|
+
Object.defineProperty(this, "onFiveModeChange", {
|
|
182
197
|
enumerable: true,
|
|
183
198
|
configurable: true,
|
|
184
199
|
writable: true,
|
|
@@ -188,7 +203,7 @@ export class TopviewFloorplanPluginController {
|
|
|
188
203
|
}
|
|
189
204
|
});
|
|
190
205
|
/** 动画结束后是 Topview 态就展示户型图 */
|
|
191
|
-
Object.defineProperty(this, "
|
|
206
|
+
Object.defineProperty(this, "onFiveInitAnimationEnded", {
|
|
192
207
|
enumerable: true,
|
|
193
208
|
configurable: true,
|
|
194
209
|
writable: true,
|
|
@@ -228,24 +243,30 @@ export class TopviewFloorplanPluginController {
|
|
|
228
243
|
this.five = five;
|
|
229
244
|
this.selector = params.selector;
|
|
230
245
|
this.configs = omit(params, ['selector']);
|
|
246
|
+
this.five.addExtraElement(this.container);
|
|
231
247
|
// 设置 container 样式
|
|
232
248
|
this.container.classList.add('floorplan-plugin');
|
|
233
249
|
Object.assign(this.container.style, pluginStyle);
|
|
234
250
|
// 如果初始化的时候模型已经加载完毕了,就不用再等 modelLoaded
|
|
235
|
-
this.five.model.loaded
|
|
251
|
+
this.five.model.loaded
|
|
252
|
+
? this.onFiveModelLoaded()
|
|
253
|
+
: five.once('modelLoaded', this.onFiveModelLoaded);
|
|
236
254
|
this.five.once('dispose', this.dispose);
|
|
237
|
-
this.five.on('modeChange', this.
|
|
238
|
-
this.five.on('
|
|
239
|
-
this.five.on('
|
|
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);
|
|
240
263
|
this.five.on('modelShownFloorChange', this.onModelShownFloorChange);
|
|
241
264
|
}
|
|
242
265
|
/** 加载户型图数据 */
|
|
243
|
-
load(data) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
this.render();
|
|
248
|
-
});
|
|
266
|
+
async load(data) {
|
|
267
|
+
const copyData = JSON.parse(JSON.stringify(data));
|
|
268
|
+
this.floorplanData = await formatData(copyData);
|
|
269
|
+
this.render();
|
|
249
270
|
}
|
|
250
271
|
/** 把插件的渲染DOM插入到对应的容器中去 */
|
|
251
272
|
appendTo(wrapper) {
|
|
@@ -256,6 +277,7 @@ export class TopviewFloorplanPluginController {
|
|
|
256
277
|
show() {
|
|
257
278
|
this.visible = true;
|
|
258
279
|
this.five.model.show(this.floorIndex);
|
|
280
|
+
this.updatePosition();
|
|
259
281
|
this.updateSize();
|
|
260
282
|
const renderDuration = 500;
|
|
261
283
|
const modelOpacity = this.configs.modelOpacity;
|
|
@@ -263,8 +285,6 @@ export class TopviewFloorplanPluginController {
|
|
|
263
285
|
changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
|
|
264
286
|
}
|
|
265
287
|
this.render(renderDuration);
|
|
266
|
-
this.five.on('wantsMoveToPano', this.handleWantsMoveToPano);
|
|
267
|
-
this.five.on('wantsPanGesture', this.handleWantsPanGesture);
|
|
268
288
|
}
|
|
269
289
|
hide() {
|
|
270
290
|
const modelOpacity = 1;
|
|
@@ -272,20 +292,28 @@ export class TopviewFloorplanPluginController {
|
|
|
272
292
|
this.visible = false;
|
|
273
293
|
changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
|
|
274
294
|
this.render();
|
|
275
|
-
|
|
276
|
-
|
|
295
|
+
}
|
|
296
|
+
/** 更新户型图位置 */
|
|
297
|
+
updatePosition() {
|
|
298
|
+
var _a;
|
|
299
|
+
const modelCenter = (_a = this.five.model) === null || _a === void 0 ? void 0 : _a.bounding.getCenter(new THREE.Vector3());
|
|
300
|
+
if (!modelCenter)
|
|
301
|
+
return;
|
|
302
|
+
const ndcModelCenter = modelCenter.clone().project(this.five.camera);
|
|
303
|
+
const left = (ndcModelCenter.x + 1) / 2;
|
|
304
|
+
const top = -(ndcModelCenter.y - 1) / 2;
|
|
305
|
+
this.container.style.left = left * 100 + '%';
|
|
306
|
+
this.container.style.top = top * 100 + '%';
|
|
277
307
|
}
|
|
278
308
|
render(duration) {
|
|
279
309
|
if (!this.container || !this.floorplanData)
|
|
280
310
|
return;
|
|
281
311
|
if (this.size.width === 0)
|
|
282
312
|
return;
|
|
283
|
-
const { northDesc, getLabelElement, cameraImageUrl,
|
|
284
|
-
const handleClick = preventRoomClick ? () => false : undefined;
|
|
313
|
+
const { northDesc, getLabelElement, cameraImageUrl, hoverEnable, compassEnable, roomLabelsEnable, ruleLabelsEnable, } = this.configs;
|
|
285
314
|
const props = {
|
|
315
|
+
getLabelElement,
|
|
286
316
|
northDesc: northDesc !== null && northDesc !== void 0 ? northDesc : '北',
|
|
287
|
-
five: this.five,
|
|
288
|
-
pxmm: this.pxmm,
|
|
289
317
|
cameraImageUrl,
|
|
290
318
|
visible: this.visible,
|
|
291
319
|
duration: duration !== null && duration !== void 0 ? duration : 0,
|
|
@@ -297,8 +325,6 @@ export class TopviewFloorplanPluginController {
|
|
|
297
325
|
ruleLabelsEnable: ruleLabelsEnable !== null && ruleLabelsEnable !== void 0 ? ruleLabelsEnable : true,
|
|
298
326
|
roomLabelsEnable: roomLabelsEnable !== null && roomLabelsEnable !== void 0 ? roomLabelsEnable : true,
|
|
299
327
|
lastPanoramaLongitude: this.lastPanoramaLongitude,
|
|
300
|
-
getLabelElement,
|
|
301
|
-
onRoomHeightClick: handleClick,
|
|
302
328
|
};
|
|
303
329
|
if (!this.app) {
|
|
304
330
|
this.app = new Main({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FivePlugin } from '@realsee/five';
|
|
1
|
+
import type { FivePlugin } from '@realsee/five';
|
|
2
2
|
import { TopviewFloorplanPluginParameterType, TopviewFloorplanPluginReturnType } from './Controller';
|
|
3
3
|
export declare const TopviewFloorplanPlugin: FivePlugin<TopviewFloorplanPluginParameterType, TopviewFloorplanPluginReturnType>;
|
|
4
4
|
export default TopviewFloorplanPlugin;
|
|
@@ -1,34 +1,21 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { FLOORPLAN_EXTRA_OBJECT_IMAGE } from '../Assets/floorplanExtraObject';
|
|
11
2
|
import { floorplanPosition2ImagePosition, getFloorIndexFromModelPosition, modelPosition2FloorplanPosition, } from './formatPosition';
|
|
12
|
-
function formatOutlines(outlines) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
url: item.url,
|
|
20
|
-
svgUrl: item.svg_url,
|
|
21
|
-
};
|
|
22
|
-
if (item.svg_url) {
|
|
23
|
-
const svgContent = yield fetch(item.svg_url, { headers }).then((res) => res.text());
|
|
24
|
-
outlineItem.svgContent = svgContent;
|
|
25
|
-
}
|
|
26
|
-
return outlineItem;
|
|
27
|
-
});
|
|
3
|
+
async function formatOutlines(outlines) {
|
|
4
|
+
const headers = new Headers({ 'Content-Type': 'text/plain' });
|
|
5
|
+
const getOutlineItem = async function (item) {
|
|
6
|
+
const outlineItem = {
|
|
7
|
+
index: item.index,
|
|
8
|
+
url: item.url,
|
|
9
|
+
svgUrl: item.svg_url,
|
|
28
10
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
if (item.svg_url) {
|
|
12
|
+
const svgContent = await fetch(item.svg_url, { headers }).then((res) => res.text());
|
|
13
|
+
outlineItem.svgContent = svgContent;
|
|
14
|
+
}
|
|
15
|
+
return outlineItem;
|
|
16
|
+
};
|
|
17
|
+
const svgOutlineItems = await Promise.all(outlines.map(getOutlineItem));
|
|
18
|
+
return svgOutlineItems;
|
|
32
19
|
}
|
|
33
20
|
function formatRoom(data) {
|
|
34
21
|
const floorplanRoomItem = {
|
|
@@ -74,21 +61,19 @@ function formatFloorplanEntrance(data) {
|
|
|
74
61
|
};
|
|
75
62
|
return floorplanEntrance;
|
|
76
63
|
}
|
|
77
|
-
export default function formatData(data) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return floorplanData;
|
|
91
|
-
});
|
|
64
|
+
export default async function formatData(data) {
|
|
65
|
+
const outlines = await formatOutlines(data.outlines);
|
|
66
|
+
const bounding = data.computed_data.bounding;
|
|
67
|
+
const floorDatas = data.computed_data.floor_datas.map(formatFloorData);
|
|
68
|
+
const entrance = data.computed_data.entrance ? formatFloorplanEntrance(data.computed_data.entrance) : null;
|
|
69
|
+
const floorplanData = {
|
|
70
|
+
outlines,
|
|
71
|
+
entrance,
|
|
72
|
+
bounding,
|
|
73
|
+
floorDatas,
|
|
74
|
+
observers: data.computed_data.observers.map(formateFloorplanObserver),
|
|
75
|
+
};
|
|
76
|
+
return floorplanData;
|
|
92
77
|
}
|
|
93
78
|
export function formatExtraObjects(data, five, floorplanData) {
|
|
94
79
|
const extraObjects = data.map((object) => {
|
|
@@ -7,7 +7,7 @@ export declare function pathD(points: Vector2Position[], options?: {
|
|
|
7
7
|
format?: (vector: Vector2Position) => Vector2Position;
|
|
8
8
|
}): string;
|
|
9
9
|
/** 把户型图上点点位转换到 SVG 上的点位 */
|
|
10
|
-
export default function formatFloorplanPoint({ x, y }: Vector2Position,
|
|
10
|
+
export default function formatFloorplanPoint({ x, y }: Vector2Position, bounding: FloorplanBounding): {
|
|
11
11
|
x: number;
|
|
12
12
|
y: number;
|
|
13
13
|
};
|
|
@@ -19,9 +19,9 @@ export function pathD(points, options = {}) {
|
|
|
19
19
|
return d + (needZ ? 'Z' : '');
|
|
20
20
|
}
|
|
21
21
|
/** 把户型图上点点位转换到 SVG 上的点位 */
|
|
22
|
-
export default function formatFloorplanPoint({ x, y },
|
|
22
|
+
export default function formatFloorplanPoint({ x, y }, bounding) {
|
|
23
23
|
const { max, min } = bounding;
|
|
24
|
-
return { x:
|
|
24
|
+
return { x: x - min.x, y: max.y - y };
|
|
25
25
|
}
|
|
26
26
|
/** 模型坐标转户型图坐标 */
|
|
27
27
|
export function modelPosition2FloorplanPosition(position, floorplanData) {
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import to from '../to';
|
|
11
|
-
export default function changeMode(five, ...changeModeParams) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
five.on('modeChange', handleModeChange);
|
|
24
|
-
});
|
|
2
|
+
export default async function changeMode(five, ...changeModeParams) {
|
|
3
|
+
const [changeModeError] = await to(five.changeMode(...changeModeParams));
|
|
4
|
+
if (changeModeError)
|
|
5
|
+
throw changeModeError;
|
|
6
|
+
await new Promise((reslove, reject) => {
|
|
7
|
+
five.once('initAnimationEnded', reslove);
|
|
8
|
+
const handleModeChange = (mode) => {
|
|
9
|
+
if (mode !== changeModeParams[0])
|
|
10
|
+
reject('changeMode 被中断');
|
|
11
|
+
five.off('modeChange', handleModeChange);
|
|
12
|
+
};
|
|
13
|
+
five.on('modeChange', handleModeChange);
|
|
25
14
|
});
|
|
26
15
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Vector3 } from 'three';
|
|
1
|
+
import type { Vector3 } from 'three';
|
|
2
2
|
export default function getNormal(a: Vector3, b: Vector3, c: Vector3): Vector3;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Group } from 'three';
|
|
1
|
+
import type { Group } from 'three';
|
|
2
2
|
export declare function loadFbxObj(url: string): Promise<Group>;
|
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader';
|
|
11
2
|
const loader = new FBXLoader();
|
|
12
|
-
export function loadFbxObj(url) {
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
loader.load(url, onLoad, undefined, onError);
|
|
22
|
-
});
|
|
3
|
+
export async function loadFbxObj(url) {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
function onLoad(object) {
|
|
6
|
+
resolve(object);
|
|
7
|
+
}
|
|
8
|
+
function onError(error) {
|
|
9
|
+
reject(error);
|
|
10
|
+
}
|
|
11
|
+
loader.load(url, onLoad, undefined, onError);
|
|
23
12
|
});
|
|
24
13
|
}
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import * as THREE from 'three';
|
|
11
2
|
const textureLoader = new THREE.TextureLoader();
|
|
12
|
-
export function loadTexture(url) {
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return texture;
|
|
19
|
-
});
|
|
3
|
+
export async function loadTexture(url) {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
textureLoader.load(url, resolve, undefined, reject);
|
|
6
|
+
}).then((texture) => {
|
|
7
|
+
texture.encoding = THREE.sRGBEncoding;
|
|
8
|
+
return texture;
|
|
20
9
|
});
|
|
21
10
|
}
|
package/libs/shared-utils/to.js
CHANGED
|
@@ -1,29 +1,18 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
/**
|
|
11
2
|
* 传入一个 Promise
|
|
12
3
|
* 无异常,返回 [null, data]
|
|
13
4
|
* 有异常,则返回 [Error, undefined]
|
|
14
5
|
* 用于替代 try&catch 处理 await 异常的方案
|
|
15
6
|
*/
|
|
16
|
-
export function to(promise) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
});
|
|
7
|
+
export async function to(promise) {
|
|
8
|
+
try {
|
|
9
|
+
const data = await promise;
|
|
10
|
+
return [null, data];
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
if (error instanceof Error)
|
|
14
|
+
return [error, null];
|
|
15
|
+
return [new Error(''), null];
|
|
16
|
+
}
|
|
28
17
|
}
|
|
29
18
|
export default to;
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"repository": "https://github.com/realsee-developer/dnalogel.git",
|
|
8
8
|
"description": "如视 VR 看房插件合集",
|
|
9
9
|
"private": false,
|
|
10
|
-
"version": "2.0.0-alpha.
|
|
10
|
+
"version": "2.0.0-alpha.20",
|
|
11
11
|
"license": "SEE LICENSE IN TERMS.txt",
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "yarn run tsb && yarn run build:rollup && yarn build:docs",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/core": "^7.17.5",
|
|
30
|
-
"@realsee/five": "^5.0.0-alpha.
|
|
30
|
+
"@realsee/five": "^5.0.0-alpha.123",
|
|
31
31
|
"@rollup/plugin-alias": "^3.1.9",
|
|
32
32
|
"@rollup/plugin-commonjs": "^21.1.0",
|
|
33
33
|
"@rollup/plugin-typescript": "^8.3.2",
|