@realsee/dnalogel 2.0.0-alpha.26 → 2.0.0-alpha.28
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 +6 -0
- package/dist/CSS3DRenderPlugin/Plugin.d.ts +49 -0
- package/dist/CSS3DRenderPlugin/index.d.ts +3 -48
- package/dist/CameraMovementPlugin/CameraMovementPlugin.d.ts +7 -0
- package/dist/CameraMovementPlugin/index.d.ts +4 -6
- package/dist/CameraMovementPlugin/index.js +12 -12
- package/dist/ModelChassisCompassPlugin/Plugin.d.ts +19 -0
- package/dist/ModelChassisCompassPlugin/index.d.ts +3 -18
- package/dist/ModelEntryDoorGuidePlugin/Plugin.d.ts +26 -0
- package/dist/ModelEntryDoorGuidePlugin/index.d.ts +3 -25
- package/dist/ModelEntryDoorGuidePlugin/index.js +0 -5
- package/dist/ModelItemLabelPlugin/ModelItemLabelPlugin.d.ts +4 -0
- package/dist/ModelItemLabelPlugin/index.d.ts +8 -3
- package/dist/ModelItemLabelPlugin/index.js +13 -7
- package/dist/ModelTVVideoPlugin/Plugin.d.ts +4 -0
- package/dist/ModelTVVideoPlugin/index.d.ts +4 -3
- package/dist/ModelTVVideoPlugin/index.js +3 -3
- package/dist/ModelViewPlugin/Plugin.d.ts +17 -0
- package/dist/ModelViewPlugin/index.d.ts +3 -16
- package/dist/PanoCompassPlugin/Plugin.d.ts +47 -0
- package/dist/PanoCompassPlugin/index.d.ts +4 -47
- package/dist/PanoCompassPlugin/index.js +5 -4
- package/dist/PanoMeasurePlugin/index.d.ts +1 -1
- package/dist/PanoMeasurePlugin/index.js +4 -1
- package/dist/PanoRulerPlugin/Plugin.d.ts +31 -0
- package/dist/PanoRulerPlugin/index.d.ts +4 -30
- package/dist/PanoRulerPlugin/index.js +0 -5
- package/dist/PanoSpatialTagPlugin/Plugin.d.ts +33 -0
- package/dist/PanoSpatialTagPlugin/index.d.ts +4 -32
- package/dist/PanoSpatialTagPlugin/index.js +23 -21
- package/dist/_index.d.ts +30 -0
- package/dist/floorplan/index.d.ts +6 -0
- package/dist/index.d.ts +15 -30
- package/dist/index.es.js +149 -22
- package/dist/index.js +177 -43
- package/dist/index.umd.js +180 -47
- package/docs/assets/search.js +1 -1
- package/docs/classes/ModelRoomLabelController.html +5 -8
- package/docs/classes/PanoFloorplanRadarPluginController.html +3 -0
- package/docs/enums/CameraMovementEffect.html +3 -0
- package/docs/enums/DIRECTION.html +1 -0
- package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -0
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ModelFloorplanErrorType.html +1 -1
- package/docs/enums/Rotation.html +3 -0
- package/docs/index.html +2 -2
- package/docs/interfaces/CSS3DRenderPluginExportType.html +4 -0
- package/docs/interfaces/CameraMovementPluginExportType.html +17 -0
- package/docs/interfaces/FloorplanBounding.html +10 -0
- package/docs/interfaces/FloorplanData.html +3 -0
- package/docs/interfaces/FloorplanEntrance.html +15 -0
- package/docs/interfaces/FloorplanExtraObject.html +7 -0
- package/docs/interfaces/FloorplanExtraObject3D.html +3 -0
- package/docs/interfaces/FloorplanFloorData.html +3 -0
- package/docs/interfaces/FloorplanImagePosition.html +3 -0
- package/docs/interfaces/FloorplanObserver.html +5 -0
- package/docs/interfaces/FloorplanOutlineItem.html +3 -0
- package/docs/interfaces/FloorplanPosition.html +3 -0
- package/docs/interfaces/FloorplanRoomItem.html +17 -0
- package/docs/interfaces/FloorplanRoomLabelItem.html +7 -0
- package/docs/interfaces/FloorplanServerBounding.html +10 -0
- package/docs/interfaces/FloorplanServerComputedData.html +1 -0
- package/docs/interfaces/FloorplanServerData.html +3 -0
- package/docs/interfaces/FloorplanServerEntrance.html +15 -0
- package/docs/interfaces/FloorplanServerFloorData.html +3 -0
- package/docs/interfaces/FloorplanServerImagePosition.html +3 -0
- package/docs/interfaces/FloorplanServerObserver.html +5 -0
- package/docs/interfaces/FloorplanServerOutlineItem.html +3 -0
- package/docs/interfaces/FloorplanServerPosition.html +3 -0
- package/docs/interfaces/FloorplanServerRoomItem.html +20 -0
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +7 -0
- 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 +3 -3
- 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 -0
- 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 -0
- package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +1 -0
- 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 -0
- package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -0
- package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -0
- package/docs/interfaces/Point.html +1 -0
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/Room.html +1 -0
- package/docs/interfaces/RoomInfo.html +1 -0
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/RoomRules.html +1 -0
- package/docs/interfaces/Rooms.html +1 -0
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +10 -10
- package/docs/modules.html +28 -12
- package/libs/CSS3DRenderPlugin/Plugin.d.ts +49 -0
- package/libs/CSS3DRenderPlugin/Plugin.js +182 -0
- package/libs/CSS3DRenderPlugin/index.d.ts +3 -48
- package/libs/CSS3DRenderPlugin/index.js +2 -181
- package/libs/CameraMovementPlugin/CameraMovementPlugin.d.ts +7 -0
- package/libs/CameraMovementPlugin/CameraMovementPlugin.js +159 -0
- package/libs/CameraMovementPlugin/index.d.ts +4 -6
- package/libs/CameraMovementPlugin/index.js +3 -158
- package/libs/ModelChassisCompassPlugin/Plugin.d.ts +19 -0
- package/libs/ModelChassisCompassPlugin/Plugin.js +75 -0
- package/libs/ModelChassisCompassPlugin/index.d.ts +3 -18
- package/libs/ModelChassisCompassPlugin/index.js +2 -74
- package/libs/ModelEntryDoorGuidePlugin/Plugin.d.ts +26 -0
- package/libs/ModelEntryDoorGuidePlugin/Plugin.js +140 -0
- package/libs/ModelEntryDoorGuidePlugin/index.d.ts +3 -25
- package/libs/ModelEntryDoorGuidePlugin/index.js +2 -139
- package/libs/ModelItemLabelPlugin/ModelItemLabelPlugin.d.ts +4 -0
- package/libs/ModelItemLabelPlugin/ModelItemLabelPlugin.js +120 -0
- package/libs/ModelItemLabelPlugin/index.d.ts +8 -3
- package/libs/ModelItemLabelPlugin/index.js +7 -119
- package/libs/ModelTVVideoPlugin/Plugin.d.ts +4 -0
- package/libs/ModelTVVideoPlugin/Plugin.js +254 -0
- package/libs/ModelTVVideoPlugin/index.d.ts +4 -3
- package/libs/ModelTVVideoPlugin/index.js +3 -253
- package/libs/ModelViewPlugin/Plugin.d.ts +17 -0
- package/libs/ModelViewPlugin/Plugin.js +160 -0
- package/libs/ModelViewPlugin/index.d.ts +3 -16
- package/libs/ModelViewPlugin/index.js +2 -159
- package/libs/PanoCompassPlugin/Plugin.d.ts +47 -0
- package/libs/PanoCompassPlugin/Plugin.js +249 -0
- package/libs/PanoCompassPlugin/index.d.ts +4 -47
- package/libs/PanoCompassPlugin/index.js +3 -249
- package/libs/PanoMeasurePlugin/index.d.ts +1 -1
- package/libs/PanoMeasurePlugin/index.js +1 -1
- package/libs/PanoRulerPlugin/Plugin.d.ts +31 -0
- package/libs/PanoRulerPlugin/Plugin.js +402 -0
- package/libs/PanoRulerPlugin/index.d.ts +4 -30
- package/libs/PanoRulerPlugin/index.js +2 -401
- package/libs/PanoSpatialTagPlugin/Plugin.d.ts +33 -0
- package/libs/PanoSpatialTagPlugin/Plugin.js +415 -0
- package/libs/PanoSpatialTagPlugin/index.d.ts +4 -32
- package/libs/PanoSpatialTagPlugin/index.js +4 -412
- package/libs/_index.d.ts +30 -0
- package/libs/_index.js +18 -0
- package/libs/floorplan/index.d.ts +6 -0
- package/libs/floorplan/index.js +7 -0
- package/libs/index.d.ts +15 -30
- package/libs/index.js +25 -17
- package/package.json +5 -4
|
@@ -1,413 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import CSS3DRenderPlugin from '../CSS3DRenderPlugin';
|
|
4
|
-
import Origins from './Components/origins';
|
|
5
|
-
import Tag from './Components/tag';
|
|
6
|
-
import { pluginStyle } from './style';
|
|
7
|
-
import render from '../shared-utils/tinyEJSrender';
|
|
8
|
-
const MESH_SIZE = 0.001;
|
|
9
|
-
const RAY_ORIGIN_Y = 1.4;
|
|
10
|
-
const RAY_TOLERANT_DISTANCE = 0.01;
|
|
11
|
-
const BLUR_IMAGE_URL = 'https://vrlab-image4.ljcdn.com/release/web/PanoSpatialTagPlugin__blur.png';
|
|
12
|
-
const MIN_DISTANCE = 1.2;
|
|
13
|
-
const MAX_DISTANCE = 3.5;
|
|
14
|
-
/**
|
|
15
|
-
* 空间游走标签插件
|
|
16
|
-
*/
|
|
17
|
-
export const PanoSpatialTagPlugin = (five, params) => {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f;
|
|
19
|
-
let wrapper = params === null || params === void 0 ? void 0 : params.container;
|
|
20
|
-
const wait = (_a = params === null || params === void 0 ? void 0 : params.wait) !== null && _a !== void 0 ? _a : 200;
|
|
21
|
-
const maxNumberOnScreen = (_b = params === null || params === void 0 ? void 0 : params.maxNumberOnScreen) !== null && _b !== void 0 ? _b : 3;
|
|
22
|
-
const minRad = (_c = params === null || params === void 0 ? void 0 : params.minRad) !== null && _c !== void 0 ? _c : Math.PI / 4;
|
|
23
|
-
const nearTolerance = (_d = params === null || params === void 0 ? void 0 : params.nearTolerance) !== null && _d !== void 0 ? _d : 100;
|
|
24
|
-
const upsideHeight = (_e = params === null || params === void 0 ? void 0 : params.upsideHeight) !== null && _e !== void 0 ? _e : 1.6;
|
|
25
|
-
// const foldPercent = params?.foldPercent ?? 20
|
|
26
|
-
const css3DRender = CSS3DRenderPlugin(five);
|
|
27
|
-
const container = document.createElement('div');
|
|
28
|
-
container.classList.add('PanoSpatialTagPlugin');
|
|
29
|
-
Object.assign(container.style, pluginStyle);
|
|
30
|
-
const hooks = new Subscribe();
|
|
31
|
-
let blurImage = new Image();
|
|
32
|
-
blurImage.src = BLUR_IMAGE_URL;
|
|
33
|
-
const state = {
|
|
34
|
-
points: [],
|
|
35
|
-
origins: [],
|
|
36
|
-
tags: [],
|
|
37
|
-
template: '',
|
|
38
|
-
events: {},
|
|
39
|
-
render,
|
|
40
|
-
folded: false,
|
|
41
|
-
enabled: true,
|
|
42
|
-
forbidden: true,
|
|
43
|
-
};
|
|
44
|
-
const origins = new Origins({
|
|
45
|
-
target: container,
|
|
46
|
-
props: { origins: state.origins },
|
|
47
|
-
});
|
|
48
|
-
const onCameraUpdate = (pose, userAction) => {
|
|
49
|
-
updateOrigins();
|
|
50
|
-
if (userAction) {
|
|
51
|
-
updateTags();
|
|
52
|
-
// state.tags.forEach(tag => {
|
|
53
|
-
// const mouse = tag.position.clone().project(five.camera)
|
|
54
|
-
// const top = ( - mouse.y + 1 ) / 2 * 100
|
|
55
|
-
// })
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const onPanoArrived = () => {
|
|
59
|
-
if (state.forbidden) {
|
|
60
|
-
state.forbidden = false;
|
|
61
|
-
updateTags();
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const onPanoWillArrive = (pano, pose) => {
|
|
65
|
-
if (state.tags.length === 0)
|
|
66
|
-
return;
|
|
67
|
-
const rotateRad = pose.longitude - five.state.longitude;
|
|
68
|
-
const camera = five.camera.clone();
|
|
69
|
-
camera.position.copy(pose.offset);
|
|
70
|
-
camera.rotateOnWorldAxis(new THREE.Vector3(0, 1, 0), rotateRad);
|
|
71
|
-
camera.updateProjectionMatrix();
|
|
72
|
-
camera.updateMatrixWorld(true);
|
|
73
|
-
const frustum = new THREE.Frustum();
|
|
74
|
-
const projScreenMatrix = new THREE.Matrix4();
|
|
75
|
-
projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
|
|
76
|
-
frustum.setFromProjectionMatrix(projScreenMatrix);
|
|
77
|
-
state.tags.forEach(tag => {
|
|
78
|
-
const distance = camera.position.clone().setY(RAY_ORIGIN_Y).distanceTo(tag.position);
|
|
79
|
-
if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
|
|
80
|
-
return tag.destroying = true;
|
|
81
|
-
if (!frustum.containsPoint(tag.position))
|
|
82
|
-
return tag.destroying = true;
|
|
83
|
-
const v = tag.position.clone().sub(camera.position).setY(0);
|
|
84
|
-
if (v.angleTo(tag.normal) > Math.PI / 2 - minRad &&
|
|
85
|
-
v.angleTo(tag.normal) < Math.PI / 2 + minRad)
|
|
86
|
-
return tag.destroying = true;
|
|
87
|
-
});
|
|
88
|
-
state.tags.forEach(tag => {
|
|
89
|
-
if (tag.destroying) {
|
|
90
|
-
tag.app.$set({
|
|
91
|
-
contentZoom: 0.1 + camera.position.distanceTo(tag.position) / MAX_DISTANCE,
|
|
92
|
-
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / MAX_DISTANCE),
|
|
93
|
-
destroying: tag.destroying,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
tag.app.$set({
|
|
98
|
-
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / MAX_DISTANCE),
|
|
99
|
-
lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) - MIN_DISTANCE) / MAX_DISTANCE * 0.6,
|
|
100
|
-
contentZoom: 0.1 + camera.position.distanceTo(tag.position) / MAX_DISTANCE,
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
setTimeout(() => {
|
|
105
|
-
state.tags.forEach(tag => {
|
|
106
|
-
if (tag.destroying) {
|
|
107
|
-
tag.app.$destroy();
|
|
108
|
-
tag = null;
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
state.tags = state.tags.filter(tag => !tag.destroying);
|
|
112
|
-
updateOrigins();
|
|
113
|
-
}, 1900);
|
|
114
|
-
};
|
|
115
|
-
const onModeChange = (mode) => {
|
|
116
|
-
if (mode !== Five.Mode.Panorama && !state.forbidden) {
|
|
117
|
-
origins.$set({ origins: [] });
|
|
118
|
-
state.tags.forEach(tag => {
|
|
119
|
-
tag.app.$destroy();
|
|
120
|
-
tag = null;
|
|
121
|
-
});
|
|
122
|
-
state.origins = [];
|
|
123
|
-
state.tags = [];
|
|
124
|
-
state.forbidden = true;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
const updateOrigins = () => {
|
|
128
|
-
if (state.forbidden || !state.enabled)
|
|
129
|
-
return;
|
|
130
|
-
const camera = five.camera;
|
|
131
|
-
const direction = camera.getWorldDirection(new THREE.Vector3());
|
|
132
|
-
state.origins = state.tags.map(tag => {
|
|
133
|
-
const mouse = tag.position.clone().project(camera);
|
|
134
|
-
const front = tag.position.clone().sub(camera.position).setY(0)
|
|
135
|
-
.angleTo(direction.setY(0)) < Math.PI / 2;
|
|
136
|
-
return {
|
|
137
|
-
id: tag.id,
|
|
138
|
-
front,
|
|
139
|
-
left: (mouse.x + 1) / 2 * 100,
|
|
140
|
-
top: (-mouse.y + 1) / 2 * 100,
|
|
141
|
-
destroying: tag.destroying,
|
|
142
|
-
};
|
|
143
|
-
});
|
|
144
|
-
origins.$set({ origins: state.origins });
|
|
145
|
-
};
|
|
146
|
-
const updateTags = () => {
|
|
147
|
-
if (state.forbidden || !state.enabled)
|
|
148
|
-
return;
|
|
149
|
-
if (state.timeoutId)
|
|
150
|
-
clearTimeout(state.timeoutId);
|
|
151
|
-
state.timeoutId = setTimeout(() => {
|
|
152
|
-
state.timeoutId = undefined;
|
|
153
|
-
const newTags = getNewTags();
|
|
154
|
-
if (newTags.length) {
|
|
155
|
-
state.tags = state.tags.concat(newTags);
|
|
156
|
-
updateOrigins();
|
|
157
|
-
}
|
|
158
|
-
}, wait);
|
|
159
|
-
};
|
|
160
|
-
const getNewTags = () => {
|
|
161
|
-
const { clientWidth, clientHeight } = five.getElement();
|
|
162
|
-
const newTags = [];
|
|
163
|
-
const camera = five.camera;
|
|
164
|
-
const frustum = new THREE.Frustum();
|
|
165
|
-
const projScreenMatrix = new THREE.Matrix4();
|
|
166
|
-
const direction = camera.getWorldDirection(new THREE.Vector3());
|
|
167
|
-
projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
|
|
168
|
-
frustum.setFromProjectionMatrix(projScreenMatrix);
|
|
169
|
-
const frontTagLength = state.tags.filter(tag => frustum.containsPoint(tag.position) && !tag.destroying).length;
|
|
170
|
-
const points = state.points.reduce((result, point) => {
|
|
171
|
-
if (state.tags.find(tag => point.id === tag.id && !tag.destroying))
|
|
172
|
-
return result;
|
|
173
|
-
const distance = camera.position.clone().setY(RAY_ORIGIN_Y).distanceTo(point.position);
|
|
174
|
-
if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
|
|
175
|
-
return result;
|
|
176
|
-
if (!frustum.containsPoint(point.position))
|
|
177
|
-
return result;
|
|
178
|
-
const v = point.position.clone().sub(camera.position).setY(0);
|
|
179
|
-
if (v.angleTo(point.normal) > Math.PI / 2 - minRad &&
|
|
180
|
-
v.angleTo(point.normal) < Math.PI / 2 + minRad)
|
|
181
|
-
return result;
|
|
182
|
-
const mouse = point.position.clone().project(camera);
|
|
183
|
-
if (!state.tags.every(tag => {
|
|
184
|
-
if (tag.position.clone().sub(camera.position).setY(0)
|
|
185
|
-
.angleTo(direction.setY(0)) > Math.PI / 2)
|
|
186
|
-
return true;
|
|
187
|
-
const _mouse = tag.position.clone().project(camera);
|
|
188
|
-
return Math.sqrt(Math.pow((mouse.x - _mouse.x) / 2 * clientWidth, 2) +
|
|
189
|
-
Math.pow((mouse.y - _mouse.y) / 2 * clientHeight, 2)) > nearTolerance;
|
|
190
|
-
}))
|
|
191
|
-
return result;
|
|
192
|
-
const newPoint = {
|
|
193
|
-
id: point.id,
|
|
194
|
-
position: point.position,
|
|
195
|
-
normal: point.normal,
|
|
196
|
-
replacement: point.replacement,
|
|
197
|
-
weight: point.weight,
|
|
198
|
-
distance,
|
|
199
|
-
};
|
|
200
|
-
let index;
|
|
201
|
-
for (let i = 0, l = result.length; i < l; i++) {
|
|
202
|
-
const anotherPoint = result[i];
|
|
203
|
-
if (newPoint.weight > anotherPoint.weight) {
|
|
204
|
-
index = i;
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
if (newPoint.distance < anotherPoint.distance) {
|
|
208
|
-
index = i;
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
if (index !== undefined)
|
|
213
|
-
result.splice(index, 0, newPoint);
|
|
214
|
-
else
|
|
215
|
-
result.push(newPoint);
|
|
216
|
-
return result;
|
|
217
|
-
}, []);
|
|
218
|
-
for (let i = 0, l = points.length; i < l; i++) {
|
|
219
|
-
if (frontTagLength + newTags.length >= maxNumberOnScreen)
|
|
220
|
-
break;
|
|
221
|
-
const point = points[i];
|
|
222
|
-
if (newTags.find(tag => point.id === tag.id))
|
|
223
|
-
continue;
|
|
224
|
-
const mouse = point.position.clone().project(camera);
|
|
225
|
-
if (!state.tags.concat(newTags).every(tag => {
|
|
226
|
-
if (tag.position.clone().sub(camera.position).setY(0)
|
|
227
|
-
.angleTo(direction.setY(0)) > Math.PI / 2)
|
|
228
|
-
return true;
|
|
229
|
-
const _mouse = tag.position.clone().project(camera);
|
|
230
|
-
return Math.sqrt(Math.pow((mouse.x - _mouse.x) / 2 * clientWidth, 2) +
|
|
231
|
-
Math.pow((mouse.y - _mouse.y) / 2 * clientHeight, 2)) > nearTolerance;
|
|
232
|
-
}))
|
|
233
|
-
continue;
|
|
234
|
-
const raycaster = new THREE.Raycaster(camera.position.clone().setY(RAY_ORIGIN_Y), point.position.clone().sub(camera.position.clone().setY(RAY_ORIGIN_Y)).normalize(), 0, point.distance + RAY_TOLERANT_DISTANCE);
|
|
235
|
-
const [intersect] = five.model.intersectRaycaster(raycaster);
|
|
236
|
-
if (!intersect)
|
|
237
|
-
continue;
|
|
238
|
-
if (point.distance - intersect.distance < RAY_TOLERANT_DISTANCE) {
|
|
239
|
-
const { position, normal, id, replacement } = point;
|
|
240
|
-
const plane = new THREE.Plane().setFromNormalAndCoplanarPoint(normal, position);
|
|
241
|
-
const right = position.clone().sub(camera.position)
|
|
242
|
-
.cross(new THREE.Vector3(0, 1, 0)).setLength(MESH_SIZE);
|
|
243
|
-
const square = [
|
|
244
|
-
position.clone(),
|
|
245
|
-
position.clone().add(right),
|
|
246
|
-
position.clone().add(new THREE.Vector3(0, MESH_SIZE, 0)).add(right),
|
|
247
|
-
position.clone().add(new THREE.Vector3(0, MESH_SIZE, 0)),
|
|
248
|
-
].map(v => plane.projectPoint(v, new THREE.Vector3()));
|
|
249
|
-
const { container, dispose } = css3DRender.create3DDomContainer(square) || {};
|
|
250
|
-
const app = new Tag({
|
|
251
|
-
target: container,
|
|
252
|
-
props: {
|
|
253
|
-
id,
|
|
254
|
-
content: state.render(state.template, replacement),
|
|
255
|
-
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) / MAX_DISTANCE),
|
|
256
|
-
lineHeightZoom: 0.4 + (camera.position.distanceTo(position) - MIN_DISTANCE) / MAX_DISTANCE * 0.6,
|
|
257
|
-
contentZoom: 0.1 + camera.position.distanceTo(position) / MAX_DISTANCE,
|
|
258
|
-
upsideDown: position.y > upsideHeight,
|
|
259
|
-
folded: state.folded,
|
|
260
|
-
events: state.events,
|
|
261
|
-
hooks,
|
|
262
|
-
dispose,
|
|
263
|
-
},
|
|
264
|
-
});
|
|
265
|
-
newTags.push({
|
|
266
|
-
position,
|
|
267
|
-
normal,
|
|
268
|
-
id,
|
|
269
|
-
app,
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return newTags;
|
|
274
|
-
};
|
|
275
|
-
/** 标签数据加载
|
|
276
|
-
* @param data.points {Array} 标签数据
|
|
277
|
-
* @param data.enabled {Boolean} 插件是否启用
|
|
278
|
-
* @param data.folded {Boolean} 标签是否默认展开
|
|
279
|
-
*/
|
|
280
|
-
const load = (data) => {
|
|
281
|
-
state.points = data.points.map(point => {
|
|
282
|
-
var _a, _b;
|
|
283
|
-
return {
|
|
284
|
-
id: point.id,
|
|
285
|
-
position: new THREE.Vector3().fromArray(point.position),
|
|
286
|
-
normal: new THREE.Vector3().fromArray(point.normal),
|
|
287
|
-
replacement: (_a = point.replacement) !== null && _a !== void 0 ? _a : {},
|
|
288
|
-
weight: (_b = point.weight) !== null && _b !== void 0 ? _b : -1,
|
|
289
|
-
};
|
|
290
|
-
});
|
|
291
|
-
if (data.render)
|
|
292
|
-
state.render = data.render;
|
|
293
|
-
if (data.template)
|
|
294
|
-
state.template = data.template;
|
|
295
|
-
if (data.events)
|
|
296
|
-
state.events = data.events;
|
|
297
|
-
if (data.enabled === false)
|
|
298
|
-
state.enabled = data.enabled;
|
|
299
|
-
if (data.folded === true)
|
|
300
|
-
state.folded = data.folded;
|
|
301
|
-
};
|
|
302
|
-
/** 标签启用
|
|
303
|
-
* 启用插件并重新计算展示标签
|
|
304
|
-
*/
|
|
305
|
-
const enable = () => {
|
|
306
|
-
state.enabled = true;
|
|
307
|
-
updateTags();
|
|
308
|
-
};
|
|
309
|
-
/** 插件禁用
|
|
310
|
-
* 1. 禁用同时会清除已展示的标签
|
|
311
|
-
* 2. 再次启用时会重新计算展示标签
|
|
312
|
-
*/
|
|
313
|
-
const disable = () => {
|
|
314
|
-
state.enabled = false;
|
|
315
|
-
origins.$set({ origins: [] });
|
|
316
|
-
state.tags.forEach(tag => {
|
|
317
|
-
tag.app.$destroy();
|
|
318
|
-
tag = null;
|
|
319
|
-
});
|
|
320
|
-
state.origins = [];
|
|
321
|
-
state.tags = [];
|
|
322
|
-
};
|
|
323
|
-
/** 展开所有标签
|
|
324
|
-
* 1. 展开所有收起的标签
|
|
325
|
-
* 2. 新标签会默认展开
|
|
326
|
-
*/
|
|
327
|
-
const unfoldAll = () => {
|
|
328
|
-
state.folded = false;
|
|
329
|
-
state.tags.forEach(tag => {
|
|
330
|
-
tag.app.$set({ folded: state.folded });
|
|
331
|
-
});
|
|
332
|
-
};
|
|
333
|
-
/** 收起所有标签
|
|
334
|
-
* 1. 收起所有展开的标签
|
|
335
|
-
* 2. 新标签会默认收起
|
|
336
|
-
*/
|
|
337
|
-
const foldAll = () => {
|
|
338
|
-
state.folded = true;
|
|
339
|
-
state.tags.forEach(tag => {
|
|
340
|
-
tag.app.$set({ folded: state.folded });
|
|
341
|
-
});
|
|
342
|
-
};
|
|
343
|
-
/** 展开单个标签
|
|
344
|
-
* @param id {Number | String} 标签ID
|
|
345
|
-
*/
|
|
346
|
-
const unfold = (id) => {
|
|
347
|
-
state.tags.forEach(tag => {
|
|
348
|
-
if (tag.id === id)
|
|
349
|
-
tag.app.$set({ folded: false });
|
|
350
|
-
});
|
|
351
|
-
};
|
|
352
|
-
/** 收起单个标签
|
|
353
|
-
* @param id {Number | String} 标签ID
|
|
354
|
-
*/
|
|
355
|
-
const fold = (id) => {
|
|
356
|
-
state.tags.forEach(tag => {
|
|
357
|
-
if (tag.id === id)
|
|
358
|
-
tag.app.$set({ folded: true });
|
|
359
|
-
});
|
|
360
|
-
};
|
|
361
|
-
const dispose = () => {
|
|
362
|
-
blurImage = null;
|
|
363
|
-
css3DRender.disposeAll();
|
|
364
|
-
origins.$destroy();
|
|
365
|
-
state.tags.forEach(tag => {
|
|
366
|
-
tag.app.$destroy();
|
|
367
|
-
tag = null;
|
|
368
|
-
});
|
|
369
|
-
state.origins = [];
|
|
370
|
-
state.tags = [];
|
|
371
|
-
five.off('panoWillArrive', onPanoWillArrive);
|
|
372
|
-
five.off('panoArrived', onPanoArrived);
|
|
373
|
-
five.off('modeChange', onModeChange);
|
|
374
|
-
five.off('cameraUpdate', onCameraUpdate);
|
|
375
|
-
};
|
|
376
|
-
if ((_f = five === null || five === void 0 ? void 0 : five.model) === null || _f === void 0 ? void 0 : _f.loaded) {
|
|
377
|
-
if (!wrapper)
|
|
378
|
-
wrapper = five.getElement().parentElement;
|
|
379
|
-
wrapper.appendChild(container);
|
|
380
|
-
state.forbidden = false;
|
|
381
|
-
updateTags();
|
|
382
|
-
five.on('panoWillArrive', onPanoWillArrive);
|
|
383
|
-
five.on('panoArrived', onPanoArrived);
|
|
384
|
-
five.on('modeChange', onModeChange);
|
|
385
|
-
five.on('cameraUpdate', onCameraUpdate);
|
|
386
|
-
}
|
|
387
|
-
else {
|
|
388
|
-
five.once('modelBvhLoaded', () => {
|
|
389
|
-
if (!wrapper)
|
|
390
|
-
wrapper = five.getElement().parentElement;
|
|
391
|
-
wrapper.appendChild(container);
|
|
392
|
-
state.forbidden = false;
|
|
393
|
-
updateTags();
|
|
394
|
-
five.on('panoWillArrive', onPanoWillArrive);
|
|
395
|
-
five.on('panoArrived', onPanoArrived);
|
|
396
|
-
five.on('modeChange', onModeChange);
|
|
397
|
-
five.on('cameraUpdate', onCameraUpdate);
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
five.on('dispose', dispose);
|
|
401
|
-
return {
|
|
402
|
-
load,
|
|
403
|
-
unfoldAll,
|
|
404
|
-
foldAll,
|
|
405
|
-
unfold,
|
|
406
|
-
fold,
|
|
407
|
-
enable,
|
|
408
|
-
disable,
|
|
409
|
-
hooks,
|
|
410
|
-
dispose,
|
|
411
|
-
};
|
|
412
|
-
};
|
|
1
|
+
import PanoSpatialTagPlugin from './Plugin';
|
|
2
|
+
export { PanoSpatialTagPlugin };
|
|
413
3
|
export default PanoSpatialTagPlugin;
|
|
4
|
+
// 类型导出
|
|
5
|
+
export * from './typings';
|
package/libs/_index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { default as ModelViewPlugin } from './ModelViewPlugin';
|
|
2
|
+
export { default as CSS3DRenderPlugin } from './CSS3DRenderPlugin';
|
|
3
|
+
export type { PanoCursorRaycasterPluginExportType } from './PanoCursorRaycasterPlugin';
|
|
4
|
+
export { default as PanoCursorRaycasterPlugin } from './PanoCursorRaycasterPlugin';
|
|
5
|
+
export type { ModelRoomLabelController, ModelRoomLabelPluginData, RoomLabel, ModelRoomLabelPluginReturnType, ModelRoomLabelPluginParameters, } from './ModelRoomLabelPlugin';
|
|
6
|
+
export { default as ModelRoomLabelPlugin } from './ModelRoomLabelPlugin';
|
|
7
|
+
export * from './floorplan/constant';
|
|
8
|
+
export type { TopviewFloorplanPluginReturnType, TopviewFloorplanPluginParameterType, } from './floorplan/TopviewFloorplanPlugin';
|
|
9
|
+
export { default as TopviewFloorplanPlugin } from './floorplan/TopviewFloorplanPlugin';
|
|
10
|
+
export type { PanoFloorplanRadarPluginReturnType, PanoFloorplanRadarPluginParameterType, } from './floorplan/PanoFloorplanRadarPlugin';
|
|
11
|
+
export { default as PanoFloorplanRadarPlugin } from './floorplan/PanoFloorplanRadarPlugin';
|
|
12
|
+
export type { ModelFloorplanParameterType, ModelFloorplanPluginReturnType, ModelFloorplanErrorType, ModelFloorplanPluginsConfigs, ModelFloorplanEventHandlers, ModelFloorplanViewEvent, } from './floorplan/ModelFloorplanPlugin';
|
|
13
|
+
export { default as ModelFloorplanPlugin } from './floorplan/ModelFloorplanPlugin';
|
|
14
|
+
export type { ModelChassisCompassPluginParameterType, ModelChassisCompassPluginData, ModelChassisCompassPluginExportType, } from './ModelChassisCompassPlugin';
|
|
15
|
+
export { default as ModelChassisCompassPlugin } from './ModelChassisCompassPlugin';
|
|
16
|
+
export type { ModelEntryDoorGuidePluginParameterType, ModelEntryDoorGuidePluginData, ModelEntryDoorGuidePluginExportType, } from './ModelEntryDoorGuidePlugin';
|
|
17
|
+
export { default as ModelEntryDoorGuidePlugin } from './ModelEntryDoorGuidePlugin';
|
|
18
|
+
export { default as CameraMovementPlugin } from './CameraMovementPlugin';
|
|
19
|
+
export type { PanoRulerPluginParameterType, PanoRulerPluginExportType, PanoRulerPluginOptions, } from './PanoRulerPlugin';
|
|
20
|
+
export { default as PanoRulerPlugin } from './PanoRulerPlugin';
|
|
21
|
+
export type { PanoCompassPluginParameterType, PanoCompassPluginExportType, PanoCompassPluginData, } from './PanoCompassPlugin';
|
|
22
|
+
export { default as PanoCompassPlugin } from './PanoCompassPlugin';
|
|
23
|
+
export type { PluginReturns, PluginEvent, LineJson, PointJson } from './PanoMeasurePlugin';
|
|
24
|
+
export { default as PanoMeasurePlugin } from './PanoMeasurePlugin';
|
|
25
|
+
export type { PanoSpatialTagPluginParameterType, PanoSpatialTagPluginData, PanoSpatialTagPluginExportType } from './PanoSpatialTagPlugin';
|
|
26
|
+
export { default as PanoSpatialTagPlugin } from './PanoSpatialTagPlugin';
|
|
27
|
+
export type { ModelItemLabelPluginData, ModelItemLabelPluginExportReturnsType, ModelItemLabelPluginParametersType } from './ModelItemLabelPlugin/typings';
|
|
28
|
+
export { default as ModelItemLabelPlugin } from './ModelItemLabelPlugin';
|
|
29
|
+
export type { ModelTVVideoPluginData, ModelTVVideoPluginParameterType, ModelTVVideoPluginExportType } from './ModelTVVideoPlugin/typings';
|
|
30
|
+
export { default as ModelTVVideoPlugin } from './ModelTVVideoPlugin';
|
package/libs/_index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { default as ModelViewPlugin } from './ModelViewPlugin';
|
|
2
|
+
export { default as CSS3DRenderPlugin } from './CSS3DRenderPlugin';
|
|
3
|
+
export { default as PanoCursorRaycasterPlugin } from './PanoCursorRaycasterPlugin';
|
|
4
|
+
export { default as ModelRoomLabelPlugin } from './ModelRoomLabelPlugin';
|
|
5
|
+
// floorplan
|
|
6
|
+
export * from './floorplan/constant';
|
|
7
|
+
export { default as TopviewFloorplanPlugin } from './floorplan/TopviewFloorplanPlugin';
|
|
8
|
+
export { default as PanoFloorplanRadarPlugin } from './floorplan/PanoFloorplanRadarPlugin';
|
|
9
|
+
export { default as ModelFloorplanPlugin } from './floorplan/ModelFloorplanPlugin';
|
|
10
|
+
export { default as ModelChassisCompassPlugin } from './ModelChassisCompassPlugin';
|
|
11
|
+
export { default as ModelEntryDoorGuidePlugin } from './ModelEntryDoorGuidePlugin';
|
|
12
|
+
export { default as CameraMovementPlugin } from './CameraMovementPlugin';
|
|
13
|
+
export { default as PanoRulerPlugin } from './PanoRulerPlugin';
|
|
14
|
+
export { default as PanoCompassPlugin } from './PanoCompassPlugin';
|
|
15
|
+
export { default as PanoMeasurePlugin } from './PanoMeasurePlugin';
|
|
16
|
+
export { default as PanoSpatialTagPlugin } from './PanoSpatialTagPlugin';
|
|
17
|
+
export { default as ModelItemLabelPlugin } from './ModelItemLabelPlugin';
|
|
18
|
+
export { default as ModelTVVideoPlugin } from './ModelTVVideoPlugin';
|
package/libs/index.d.ts
CHANGED
|
@@ -1,30 +1,15 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export * from './
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export type { ModelEntryDoorGuidePluginParameterType, ModelEntryDoorGuidePluginData, ModelEntryDoorGuidePluginExportType, } from './ModelEntryDoorGuidePlugin';
|
|
17
|
-
export { default as ModelEntryDoorGuidePlugin } from './ModelEntryDoorGuidePlugin';
|
|
18
|
-
export { default as CameraMovementPlugin } from './CameraMovementPlugin';
|
|
19
|
-
export type { PanoRulerPluginParameterType, PanoRulerPluginExportType, PanoRulerPluginOptions, } from './PanoRulerPlugin';
|
|
20
|
-
export { default as PanoRulerPlugin } from './PanoRulerPlugin';
|
|
21
|
-
export type { PanoCompassPluginParameterType, PanoCompassPluginExportType, PanoCompassPluginData, } from './PanoCompassPlugin';
|
|
22
|
-
export { default as PanoCompassPlugin } from './PanoCompassPlugin';
|
|
23
|
-
export type { PluginReturns, PluginEvent, LineJson, PointJson } from './PanoMeasurePlugin';
|
|
24
|
-
export { default as PanoMeasurePlugin } from './PanoMeasurePlugin';
|
|
25
|
-
export type { PanoSpatialTagPluginParameterType, PanoSpatialTagPluginData, PanoSpatialTagPluginExportType } from './PanoSpatialTagPlugin';
|
|
26
|
-
export { default as PanoSpatialTagPlugin } from './PanoSpatialTagPlugin';
|
|
27
|
-
export type { ModelItemLabelPluginData, ModelItemLabelPluginExportReturnsType, ModelItemLabelPluginParametersType } from './ModelItemLabelPlugin/typings';
|
|
28
|
-
export { default as ModelItemLabelPlugin } from './ModelItemLabelPlugin';
|
|
29
|
-
export type { ModelTVVideoPluginData, ModelTVVideoPluginParameterType, ModelTVVideoPluginExportType } from './ModelTVVideoPlugin/typings';
|
|
30
|
-
export { default as ModelTVVideoPlugin } from './ModelTVVideoPlugin';
|
|
1
|
+
export * from './shared-utils/five/useFivePlugin';
|
|
2
|
+
export * from './ModelViewPlugin';
|
|
3
|
+
export * from './CSS3DRenderPlugin';
|
|
4
|
+
export * from './PanoCursorRaycasterPlugin';
|
|
5
|
+
export * from './ModelRoomLabelPlugin';
|
|
6
|
+
export * from './floorplan';
|
|
7
|
+
export * from './ModelChassisCompassPlugin';
|
|
8
|
+
export * from './ModelEntryDoorGuidePlugin';
|
|
9
|
+
export * from './CameraMovementPlugin';
|
|
10
|
+
export * from './PanoRulerPlugin';
|
|
11
|
+
export * from './PanoCompassPlugin';
|
|
12
|
+
export * from './PanoMeasurePlugin';
|
|
13
|
+
export * from './PanoSpatialTagPlugin';
|
|
14
|
+
export * from './ModelItemLabelPlugin';
|
|
15
|
+
export * from './ModelTVVideoPlugin';
|
package/libs/index.js
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
// 方法导出
|
|
2
|
+
export * from './shared-utils/five/useFivePlugin';
|
|
3
|
+
export * from './ModelViewPlugin';
|
|
4
|
+
export * from './CSS3DRenderPlugin';
|
|
5
|
+
export * from './PanoCursorRaycasterPlugin';
|
|
6
|
+
// 模型房屋标签
|
|
7
|
+
export * from './ModelRoomLabelPlugin';
|
|
5
8
|
// floorplan
|
|
6
|
-
export * from './floorplan
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
|
|
9
|
+
export * from './floorplan';
|
|
10
|
+
// 模型底盘
|
|
11
|
+
export * from './ModelChassisCompassPlugin';
|
|
12
|
+
// 模型入户门
|
|
13
|
+
export * from './ModelEntryDoorGuidePlugin';
|
|
14
|
+
export * from './CameraMovementPlugin';
|
|
15
|
+
// 全景标尺
|
|
16
|
+
export * from './PanoRulerPlugin';
|
|
17
|
+
// 全景指南针
|
|
18
|
+
export * from './PanoCompassPlugin';
|
|
19
|
+
// pc 全景测量工具
|
|
20
|
+
export * from './PanoMeasurePlugin';
|
|
21
|
+
// 空间三维标签
|
|
22
|
+
export * from './PanoSpatialTagPlugin';
|
|
23
|
+
// 模型物品标签插件
|
|
24
|
+
export * from './ModelItemLabelPlugin';
|
|
25
|
+
// 模型电视插件
|
|
26
|
+
export * from './ModelTVVideoPlugin';
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@realsee/dnalogel",
|
|
3
|
-
"main": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"main": "dist/index.js",
|
|
4
|
+
"module": "dist/index.es.js",
|
|
5
|
+
"browser": "dist/index.umd.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
6
7
|
"author": "REALSEE-DEVELOPER",
|
|
7
8
|
"repository": "https://github.com/realsee-developer/dnalogel.git",
|
|
8
9
|
"description": "如视 VR 看房插件合集",
|
|
9
10
|
"private": false,
|
|
10
|
-
"version": "2.0.0-alpha.
|
|
11
|
+
"version": "2.0.0-alpha.28",
|
|
11
12
|
"license": "SEE LICENSE IN TERMS.txt",
|
|
12
13
|
"scripts": {
|
|
13
14
|
"build": "yarn run tsb && yarn run build:rollup && yarn build:docs",
|