@realsee/dnalogel 2.0.0-alpha.12 → 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/index.js +18 -17
- package/dist/ModelRoomLabelPlugin/index.js +67 -26
- 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 +64 -29
- package/dist/floorplan/ModelFloorplanPlugin/index.js +586 -362
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +311 -153
- package/dist/index.es.js +2663 -1341
- package/dist/index.js +2667 -1345
- package/dist/index.umd.js +2667 -1345
- package/docs/assets/main.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/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 +12 -10
- package/libs/ModelItemLabelPlugin/index.js +5 -3
- package/libs/ModelItemLabelPlugin/utils/parseData.js +1 -4
- package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
- package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +3 -3
- 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/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 +7 -2
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +456 -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.js +231 -108
- package/libs/floorplan/utils/formatData.js +43 -28
- package/libs/floorplan/utils/formatPosition.js +1 -1
- 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 +1 -1
- package/CHANGELOG.md +0 -41
|
@@ -1,3 +1,12 @@
|
|
|
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
|
+
};
|
|
1
10
|
import * as THREE from 'three';
|
|
2
11
|
import { getRoomInfoInstance } from './getRoomInfoInstance';
|
|
3
12
|
import { loadTexture } from '../shared-utils/three/loadTexture';
|
|
@@ -12,17 +21,166 @@ export const PanoCompassPlugin = function (five, config) {
|
|
|
12
21
|
};
|
|
13
22
|
export default PanoCompassPlugin;
|
|
14
23
|
class PanoCompassController {
|
|
15
|
-
five;
|
|
16
|
-
data;
|
|
17
|
-
config;
|
|
18
|
-
group = new THREE.Group();
|
|
19
|
-
modelLoaded = false;
|
|
20
|
-
roomInfoInstance;
|
|
21
|
-
roomInfoWrapperInstance;
|
|
22
|
-
compassMeshTween;
|
|
23
|
-
compassMesh;
|
|
24
|
-
entryDoorMesh;
|
|
25
24
|
constructor(five, config) {
|
|
25
|
+
Object.defineProperty(this, "five", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: void 0
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(this, "data", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: void 0
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(this, "config", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: void 0
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(this, "group", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true,
|
|
47
|
+
value: new THREE.Group()
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(this, "modelLoaded", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
writable: true,
|
|
53
|
+
value: false
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(this, "roomInfoInstance", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: void 0
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(this, "roomInfoWrapperInstance", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
configurable: true,
|
|
64
|
+
writable: true,
|
|
65
|
+
value: void 0
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(this, "compassMeshTween", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
configurable: true,
|
|
70
|
+
writable: true,
|
|
71
|
+
value: void 0
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(this, "compassMesh", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
configurable: true,
|
|
76
|
+
writable: true,
|
|
77
|
+
value: void 0
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(this, "entryDoorMesh", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
configurable: true,
|
|
82
|
+
writable: true,
|
|
83
|
+
value: void 0
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(this, "dispose", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
configurable: true,
|
|
88
|
+
writable: true,
|
|
89
|
+
value: () => {
|
|
90
|
+
var _a, _b, _c, _d;
|
|
91
|
+
this.five.scene.remove(this.group);
|
|
92
|
+
this.group.remove(...this.group.children);
|
|
93
|
+
(_b = (_a = this.compassMesh) === null || _a === void 0 ? void 0 : _a.material.map) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
94
|
+
(_d = (_c = this.entryDoorMesh) === null || _c === void 0 ? void 0 : _c.material.map) === null || _d === void 0 ? void 0 : _d.dispose();
|
|
95
|
+
this.five.off('panoArrived', this.onFivePanoArrived);
|
|
96
|
+
this.five.off('panoWillArrive', this.onFivePanoWillArrive);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
Object.defineProperty(this, "onFiveFistPanoLoaded", {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
configurable: true,
|
|
102
|
+
writable: true,
|
|
103
|
+
value: () => {
|
|
104
|
+
this.modelLoaded = true;
|
|
105
|
+
if (this.data)
|
|
106
|
+
this.init();
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
Object.defineProperty(this, "onFivePanoWillArrive", {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
configurable: true,
|
|
112
|
+
writable: true,
|
|
113
|
+
value: (panoIndex) => {
|
|
114
|
+
var _a, _b;
|
|
115
|
+
if (panoIndex === this.five.panoIndex)
|
|
116
|
+
return;
|
|
117
|
+
(_a = this.compassMeshTween) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
118
|
+
(_b = this.compassMesh) === null || _b === void 0 ? void 0 : _b.material.setValues({ opacity: 0 });
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
Object.defineProperty(this, "onFivePanoArrived", {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
configurable: true,
|
|
124
|
+
writable: true,
|
|
125
|
+
value: (panoIndex) => {
|
|
126
|
+
var _a, _b, _c, _d;
|
|
127
|
+
// ======== fix compass position ========
|
|
128
|
+
const standingPosition = this.five.work.observers[panoIndex].standingPosition;
|
|
129
|
+
if (this.compassMesh) {
|
|
130
|
+
// 指南针上移 0.01m,防止与地板重合
|
|
131
|
+
this.compassMesh.position.copy(standingPosition.clone().setY(standingPosition.y + 0.01));
|
|
132
|
+
if (this.compassMesh.material.opacity !== 0)
|
|
133
|
+
return;
|
|
134
|
+
(_a = this.compassMeshTween) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
135
|
+
this.compassMeshTween = tweenProgress(1000)
|
|
136
|
+
.onUpdate(({ progress }) => {
|
|
137
|
+
var _a;
|
|
138
|
+
(_a = this.compassMesh) === null || _a === void 0 ? void 0 : _a.material.setValues({ opacity: progress });
|
|
139
|
+
this.five.needsRender = true;
|
|
140
|
+
})
|
|
141
|
+
.play();
|
|
142
|
+
}
|
|
143
|
+
// ======== fix entry door label position and rotation ========
|
|
144
|
+
if (this.entryDoorMesh) {
|
|
145
|
+
const entryDoorPosition = new THREE.Vector3(this.data.entrance.position.x, this.data.entrance.position.y, this.data.entrance.position.z);
|
|
146
|
+
const panoToEntryDoorVector = entryDoorPosition
|
|
147
|
+
.clone()
|
|
148
|
+
.setY(standingPosition.y)
|
|
149
|
+
.sub(standingPosition)
|
|
150
|
+
.normalize();
|
|
151
|
+
const compassEntryDoorPosition = standingPosition
|
|
152
|
+
.clone()
|
|
153
|
+
.add(panoToEntryDoorVector.clone().multiplyScalar(0.7))
|
|
154
|
+
.setY(standingPosition.y + 0.01);
|
|
155
|
+
this.entryDoorMesh.rotation.z = new THREE.Vector3(0, 0, -1).angleTo(panoToEntryDoorVector);
|
|
156
|
+
this.entryDoorMesh.position.copy(compassEntryDoorPosition);
|
|
157
|
+
// 不是客厅时,隐藏入户门指引
|
|
158
|
+
((_b = this.data) === null || _b === void 0 ? void 0 : _b.room_observers[panoIndex].room.type) === 1
|
|
159
|
+
? (_c = this.entryDoorMesh) === null || _c === void 0 ? void 0 : _c.material.setValues({ opacity: 1 })
|
|
160
|
+
: (_d = this.entryDoorMesh) === null || _d === void 0 ? void 0 : _d.material.setValues({ opacity: 0 });
|
|
161
|
+
}
|
|
162
|
+
// ======== fix room info ========
|
|
163
|
+
if (this.roomInfoInstance && this.roomInfoWrapperInstance) {
|
|
164
|
+
this.roomInfoWrapperInstance.css3DObject.position.copy(standingPosition.clone().setY(standingPosition.y + 0.01));
|
|
165
|
+
this.roomInfoInstance.setRoom(this.data.room_observers[panoIndex].room);
|
|
166
|
+
}
|
|
167
|
+
this.five.needsRender = true;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(this, "onFiveCameraDirectionUpdate", {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
configurable: true,
|
|
173
|
+
writable: true,
|
|
174
|
+
value: ({ longitude, latitude, }) => {
|
|
175
|
+
var _a, _b;
|
|
176
|
+
if (!this.roomInfoWrapperInstance)
|
|
177
|
+
return;
|
|
178
|
+
this.roomInfoWrapperInstance.css3DObject.rotation.z = longitude;
|
|
179
|
+
latitude > 0.66 && this.five.getCurrentState().mode === 'Panorama'
|
|
180
|
+
? (_a = this.roomInfoInstance) === null || _a === void 0 ? void 0 : _a.show()
|
|
181
|
+
: (_b = this.roomInfoInstance) === null || _b === void 0 ? void 0 : _b.hide();
|
|
182
|
+
}
|
|
183
|
+
});
|
|
26
184
|
this.five = five;
|
|
27
185
|
this.config = config;
|
|
28
186
|
this.five.scene.add(this.group);
|
|
@@ -37,70 +195,65 @@ class PanoCompassController {
|
|
|
37
195
|
if (this.modelLoaded)
|
|
38
196
|
this.init();
|
|
39
197
|
}
|
|
40
|
-
|
|
41
|
-
this
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
62
|
-
}
|
|
63
|
-
if (this.data.entrance != null) {
|
|
64
|
-
this.entryDoorMesh = await this.loadEntryDoorMesh();
|
|
65
|
-
this.roomInfoWrapperInstance = this.loadRoomInfo();
|
|
66
|
-
this.roomInfoInstance = getRoomInfoInstance();
|
|
67
|
-
this.entryDoorMesh.rotateX(-Math.PI / 2);
|
|
68
|
-
if (this.roomInfoWrapperInstance)
|
|
69
|
-
this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
|
|
70
|
-
this.group.add(this.entryDoorMesh);
|
|
71
|
-
}
|
|
72
|
-
this.onFivePanoArrived(this.five.panoIndex || 0);
|
|
73
|
-
this.five.needsRender = true;
|
|
198
|
+
init() {
|
|
199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
if (!this.data || !this.modelLoaded)
|
|
201
|
+
return;
|
|
202
|
+
const northRad = this.data.north_rad;
|
|
203
|
+
if (northRad != null) {
|
|
204
|
+
this.compassMesh = yield this.loadCompassMesh();
|
|
205
|
+
this.compassMesh.rotateX(-Math.PI / 2);
|
|
206
|
+
this.compassMesh.rotateZ(northRad - Math.PI / 2);
|
|
207
|
+
this.group.add(this.compassMesh);
|
|
208
|
+
}
|
|
209
|
+
if (this.data.entrance != null) {
|
|
210
|
+
this.entryDoorMesh = yield this.loadEntryDoorMesh();
|
|
211
|
+
this.roomInfoWrapperInstance = this.loadRoomInfo();
|
|
212
|
+
this.roomInfoInstance = getRoomInfoInstance();
|
|
213
|
+
this.entryDoorMesh.rotateX(-Math.PI / 2);
|
|
214
|
+
if (this.roomInfoWrapperInstance)
|
|
215
|
+
this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
|
|
216
|
+
this.group.add(this.entryDoorMesh);
|
|
217
|
+
}
|
|
218
|
+
this.onFivePanoArrived(this.five.panoIndex || 0);
|
|
219
|
+
this.five.needsRender = true;
|
|
220
|
+
});
|
|
74
221
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
222
|
+
loadCompassMesh() {
|
|
223
|
+
var _a;
|
|
224
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
+
const compassImageUrl = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.compassImageUrl) ||
|
|
226
|
+
'//vrlab-image4.ljcdn.com/release/web/v3/north-point-circle.96498e69.png';
|
|
227
|
+
const compassTexture = yield loadTexture(compassImageUrl);
|
|
228
|
+
const compassGeometry = new THREE.CircleGeometry(0.7, 32);
|
|
229
|
+
const compassMaterial = new THREE.MeshBasicMaterial({
|
|
230
|
+
map: compassTexture,
|
|
231
|
+
transparent: true,
|
|
232
|
+
opacity: 0,
|
|
233
|
+
depthTest: false,
|
|
234
|
+
});
|
|
235
|
+
const compassMesh = new THREE.Mesh(compassGeometry, compassMaterial);
|
|
236
|
+
compassMesh.name = 'pano-compass-mesh';
|
|
237
|
+
return compassMesh;
|
|
238
|
+
});
|
|
89
239
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
240
|
+
loadEntryDoorMesh() {
|
|
241
|
+
var _a;
|
|
242
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
243
|
+
const entryDoorImageUrl = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.entryDoorImageUrl) ||
|
|
244
|
+
'//vrlab-image4.ljcdn.com/release/web/enterDoor.831b8208.png';
|
|
245
|
+
const entryDoorTexture = yield loadTexture(entryDoorImageUrl);
|
|
246
|
+
const entryDoorGeometry = new THREE.PlaneGeometry(0.2, 0.16);
|
|
247
|
+
const entryDoorMaterial = new THREE.MeshBasicMaterial({
|
|
248
|
+
map: entryDoorTexture,
|
|
249
|
+
transparent: true,
|
|
250
|
+
opacity: 0.8,
|
|
251
|
+
depthTest: false,
|
|
252
|
+
});
|
|
253
|
+
const entryDoorMesh = new THREE.Mesh(entryDoorGeometry, entryDoorMaterial);
|
|
254
|
+
entryDoorMesh.name = 'pano-compass-entry-door';
|
|
255
|
+
return entryDoorMesh;
|
|
256
|
+
});
|
|
104
257
|
}
|
|
105
258
|
loadRoomInfo() {
|
|
106
259
|
const points = [
|
|
@@ -112,60 +265,4 @@ class PanoCompassController {
|
|
|
112
265
|
const roomInfo = CSS3DRenderPlugin(this.five).create3DDomContainer(points);
|
|
113
266
|
return roomInfo;
|
|
114
267
|
}
|
|
115
|
-
onFivePanoWillArrive = (panoIndex) => {
|
|
116
|
-
if (panoIndex === this.five.panoIndex)
|
|
117
|
-
return;
|
|
118
|
-
this.compassMeshTween?.dispose();
|
|
119
|
-
this.compassMesh?.material.setValues({ opacity: 0 });
|
|
120
|
-
};
|
|
121
|
-
onFivePanoArrived = (panoIndex) => {
|
|
122
|
-
// ======== fix compass position ========
|
|
123
|
-
const standingPosition = this.five.work.observers[panoIndex].standingPosition;
|
|
124
|
-
if (this.compassMesh) {
|
|
125
|
-
// 指南针上移 0.01m,防止与地板重合
|
|
126
|
-
this.compassMesh.position.copy(standingPosition.clone().setY(standingPosition.y + 0.01));
|
|
127
|
-
if (this.compassMesh.material.opacity !== 0)
|
|
128
|
-
return;
|
|
129
|
-
this.compassMeshTween?.dispose();
|
|
130
|
-
this.compassMeshTween = tweenProgress(1000)
|
|
131
|
-
.onUpdate(({ progress }) => {
|
|
132
|
-
this.compassMesh?.material.setValues({ opacity: progress });
|
|
133
|
-
this.five.needsRender = true;
|
|
134
|
-
})
|
|
135
|
-
.play();
|
|
136
|
-
}
|
|
137
|
-
// ======== fix entry door label position and rotation ========
|
|
138
|
-
if (this.entryDoorMesh) {
|
|
139
|
-
const entryDoorPosition = new THREE.Vector3(this.data.entrance.position.x, this.data.entrance.position.y, this.data.entrance.position.z);
|
|
140
|
-
const panoToEntryDoorVector = entryDoorPosition
|
|
141
|
-
.clone()
|
|
142
|
-
.setY(standingPosition.y)
|
|
143
|
-
.sub(standingPosition)
|
|
144
|
-
.normalize();
|
|
145
|
-
const compassEntryDoorPosition = standingPosition
|
|
146
|
-
.clone()
|
|
147
|
-
.add(panoToEntryDoorVector.clone().multiplyScalar(0.7))
|
|
148
|
-
.setY(standingPosition.y + 0.01);
|
|
149
|
-
this.entryDoorMesh.rotation.z = new THREE.Vector3(0, 0, -1).angleTo(panoToEntryDoorVector);
|
|
150
|
-
this.entryDoorMesh.position.copy(compassEntryDoorPosition);
|
|
151
|
-
// 不是客厅时,隐藏入户门指引
|
|
152
|
-
this.data?.room_observers[panoIndex].room.type === 1
|
|
153
|
-
? this.entryDoorMesh?.material.setValues({ opacity: 1 })
|
|
154
|
-
: this.entryDoorMesh?.material.setValues({ opacity: 0 });
|
|
155
|
-
}
|
|
156
|
-
// ======== fix room info ========
|
|
157
|
-
if (this.roomInfoInstance && this.roomInfoWrapperInstance) {
|
|
158
|
-
this.roomInfoWrapperInstance.css3DObject.position.copy(standingPosition.clone().setY(standingPosition.y + 0.01));
|
|
159
|
-
this.roomInfoInstance.setRoom(this.data.room_observers[panoIndex].room);
|
|
160
|
-
}
|
|
161
|
-
this.five.needsRender = true;
|
|
162
|
-
};
|
|
163
|
-
onFiveCameraDirectionUpdate = ({ longitude, latitude, }) => {
|
|
164
|
-
if (!this.roomInfoWrapperInstance)
|
|
165
|
-
return;
|
|
166
|
-
this.roomInfoWrapperInstance.css3DObject.rotation.z = longitude;
|
|
167
|
-
latitude > 0.66 && this.five.getCurrentState().mode === 'Panorama'
|
|
168
|
-
? this.roomInfoInstance?.show()
|
|
169
|
-
: this.roomInfoInstance?.hide();
|
|
170
|
-
};
|
|
171
268
|
}
|
|
@@ -40,20 +40,22 @@ export const PanoCursorRaycasterPlugin = (five) => {
|
|
|
40
40
|
return { clear, pointAxesHelperMesh };
|
|
41
41
|
};
|
|
42
42
|
const canSeePoint = (point, distanceError = 0) => {
|
|
43
|
-
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const cameraPosition = (_a = five === null || five === void 0 ? void 0 : five.camera) === null || _a === void 0 ? void 0 : _a.position;
|
|
44
45
|
if (!cameraPosition)
|
|
45
46
|
return false;
|
|
46
47
|
const distance = point.distanceTo(cameraPosition);
|
|
47
48
|
const direction = point.sub(cameraPosition).normalize();
|
|
48
49
|
const raycaster = new Raycaster(cameraPosition, direction);
|
|
49
|
-
const intersection = five.model.intersectRaycaster(raycaster)
|
|
50
|
+
const intersection = (_b = five.model.intersectRaycaster(raycaster)) === null || _b === void 0 ? void 0 : _b[0];
|
|
50
51
|
return !(intersection && intersection.distance + distanceError < distance);
|
|
51
52
|
};
|
|
52
53
|
const intersection = () => {
|
|
53
54
|
return state.intersection;
|
|
54
55
|
};
|
|
55
56
|
const destroy = () => {
|
|
56
|
-
|
|
57
|
+
var _a, _b;
|
|
58
|
+
(_b = (_a = state.disposers) === null || _a === void 0 ? void 0 : _a.forEach) === null || _b === void 0 ? void 0 : _b.call(_a, (d) => d === null || d === void 0 ? void 0 : d());
|
|
57
59
|
five.off('intersectionOnModelUpdate', updateIntersection);
|
|
58
60
|
five.off('intersectionHidden', clearIntersection);
|
|
59
61
|
};
|
|
@@ -1,16 +1,74 @@
|
|
|
1
1
|
import { preventDefault } from '../utils/ironbox';
|
|
2
2
|
export default class BaseController {
|
|
3
|
-
five;
|
|
4
|
-
group;
|
|
5
|
-
model;
|
|
6
|
-
disposed = false;
|
|
7
|
-
mouseGroup;
|
|
8
|
-
container;
|
|
9
|
-
fiveHelper;
|
|
10
|
-
hook;
|
|
11
|
-
magnifier;
|
|
12
|
-
userDistanceItemCreator;
|
|
13
3
|
constructor(params) {
|
|
4
|
+
Object.defineProperty(this, "five", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true,
|
|
8
|
+
value: void 0
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(this, "group", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: void 0
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "model", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: void 0
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(this, "disposed", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: false
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(this, "mouseGroup", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: void 0
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(this, "container", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: void 0
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(this, "fiveHelper", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
configurable: true,
|
|
43
|
+
writable: true,
|
|
44
|
+
value: void 0
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(this, "hook", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true,
|
|
50
|
+
value: void 0
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(this, "magnifier", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true,
|
|
56
|
+
value: void 0
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(this, "userDistanceItemCreator", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
value: void 0
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(this, "updateDistanceUI", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: true,
|
|
67
|
+
writable: true,
|
|
68
|
+
value: () => {
|
|
69
|
+
this.model.lines.forEach((line) => line.distanceItem.update(this.five));
|
|
70
|
+
}
|
|
71
|
+
});
|
|
14
72
|
// ==================== Params ====================
|
|
15
73
|
this.five = params.five;
|
|
16
74
|
this.hook = params.hook;
|
|
@@ -33,9 +91,6 @@ export default class BaseController {
|
|
|
33
91
|
line.distanceItem.remove();
|
|
34
92
|
this.five.needsRender = true;
|
|
35
93
|
}
|
|
36
|
-
updateDistanceUI = () => {
|
|
37
|
-
this.model.lines.forEach((line) => line.distanceItem.update(this.five));
|
|
38
|
-
};
|
|
39
94
|
updateMouseGroup(intersection, mesh) {
|
|
40
95
|
if (!intersection)
|
|
41
96
|
return this.mouseGroup;
|