@realsee/dnalogel 2.0.0-alpha.34 → 2.0.0-alpha.35
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/PanoSpatialTagPlugin/Plugin.d.ts +2 -0
- package/dist/PanoSpatialTagPlugin/index.js +57 -48
- package/dist/index.es.js +57 -48
- package/dist/index.js +57 -48
- package/dist/index.umd.js +57 -48
- package/docs/assets/search.js +1 -1
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- package/docs/classes/PanoFloorplanRadarPluginController.html +2 -2
- package/docs/enums/CameraMovementEffect.html +2 -2
- package/docs/enums/DIRECTION.html +1 -1
- package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/ModelFloorplanErrorType.html +1 -1
- package/docs/enums/Rotation.html +2 -2
- package/docs/index.html +1 -1
- package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
- package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/FloorplanBounding.html +4 -4
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +7 -7
- package/docs/interfaces/FloorplanExtraObject.html +3 -3
- package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
- package/docs/interfaces/FloorplanFloorData.html +2 -2
- package/docs/interfaces/FloorplanImagePosition.html +2 -2
- package/docs/interfaces/FloorplanObserver.html +2 -2
- package/docs/interfaces/FloorplanOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanPosition.html +2 -2
- package/docs/interfaces/FloorplanRoomItem.html +6 -6
- package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
- package/docs/interfaces/FloorplanServerBounding.html +4 -4
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerEntrance.html +7 -7
- package/docs/interfaces/FloorplanServerFloorData.html +2 -2
- package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
- package/docs/interfaces/FloorplanServerObserver.html +2 -2
- package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanServerPosition.html +2 -2
- package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
- package/docs/interfaces/ItemLabelPluginData.html +1 -1
- package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/LineJson.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
- package/docs/interfaces/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/ModelViewPluginExportType.html +1 -1
- package/docs/interfaces/OpenParameter.html +2 -2
- package/docs/interfaces/PanoCompassPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
- package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +1 -1
- package/docs/interfaces/PanoMeasureParameterType.html +1 -1
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
- package/docs/interfaces/Point.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/Room.html +1 -1
- package/docs/interfaces/RoomInfo.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/RoomRules.html +1 -1
- package/docs/interfaces/Rooms.html +1 -1
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +9 -9
- package/docs/modules.html +20 -20
- package/libs/ModelSimulationPlugin/index.d.ts +33 -0
- package/libs/ModelSimulationPlugin/index.js +166 -0
- package/libs/ModelSimulationPlugin/shaders/fragment.d.ts +2 -0
- package/libs/ModelSimulationPlugin/shaders/fragment.js +96 -0
- package/libs/ModelSimulationPlugin/shaders/vertex.d.ts +2 -0
- package/libs/ModelSimulationPlugin/shaders/vertex.js +23 -0
- package/libs/PanoSpatialTagPlugin/Components/tag.js +2 -2
- package/libs/PanoSpatialTagPlugin/Plugin.d.ts +2 -0
- package/libs/PanoSpatialTagPlugin/Plugin.js +55 -46
- package/libs/floorplan/ModelFloorplanPlugin/Assets/compass.d.ts +1 -0
- package/libs/floorplan/ModelFloorplanPlugin/Assets/compass.js +1 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/Camera.js +120 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +106 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/CurrentFloor/CurrentFloor.js +463 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/Main.js +375 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +171 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabels.js +265 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleItem.js +301 -0
- package/libs/floorplan/ModelFloorplanPlugin/Components/RuleLabels/RuleLabels.js +219 -0
- package/libs/shared-utils/five/useFivePlugin.d.ts +1 -0
- package/libs/shared-utils/five/useFivePlugin.js +8 -0
- package/libs/shared-utils/useDebounce.d.ts +8 -0
- package/libs/shared-utils/useDebounce.js +22 -0
- package/libs/shared-utils/useThrottle.d.ts +8 -0
- package/libs/shared-utils/useThrottle.js +25 -0
- package/package.json +1 -1
|
@@ -15,6 +15,8 @@ export interface PanoSpatialTagPluginParameterType {
|
|
|
15
15
|
minRad?: number;
|
|
16
16
|
nearTolerance?: number;
|
|
17
17
|
upsideHeight?: number;
|
|
18
|
+
minDistance?: number;
|
|
19
|
+
maxDistance?: number;
|
|
18
20
|
}
|
|
19
21
|
export interface PanoSpatialTagPluginExportType {
|
|
20
22
|
load: (data: PanoSpatialTagPluginData) => void;
|
|
@@ -423,7 +423,7 @@ function create_fragment(ctx) {
|
|
|
423
423
|
div3 = internal.element("div");
|
|
424
424
|
div2 = internal.element("div");
|
|
425
425
|
internal.attr(div0, "class", "PanoSpatialTagPlugin__tag-shadow svelte-eb8bdm");
|
|
426
|
-
internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
|
|
426
|
+
internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
|
|
427
427
|
internal.attr(i0, "class", "PanoSpatialTagPlugin__tag-flagpole svelte-eb8bdm");
|
|
428
428
|
internal.set_style(i0, "width", /*lineWidthZoom*/ ctx[4] + "rem");
|
|
429
429
|
internal.attr(i1, "class", "PanoSpatialTagPlugin__tag-line1 svelte-eb8bdm");
|
|
@@ -463,7 +463,7 @@ function create_fragment(ctx) {
|
|
|
463
463
|
},
|
|
464
464
|
p(ctx, [dirty]) {
|
|
465
465
|
if (dirty & /*contentWidth, contentZoom, contentHeight, upsideDown*/ 394) {
|
|
466
|
-
internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
|
|
466
|
+
internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
|
|
467
467
|
}
|
|
468
468
|
|
|
469
469
|
if (dirty & /*lineWidthZoom*/ 16) {
|
|
@@ -885,22 +885,22 @@ class Template {
|
|
|
885
885
|
}
|
|
886
886
|
|
|
887
887
|
const MESH_SIZE = 0.001;
|
|
888
|
-
const RAY_ORIGIN_Y = 1.4;
|
|
889
888
|
const RAY_TOLERANT_DISTANCE = 0.01;
|
|
890
889
|
const BLUR_IMAGE_URL = 'https://vrlab-image4.ljcdn.com/release/web/PanoSpatialTagPlugin__blur.png';
|
|
891
|
-
const MIN_DISTANCE = 1.2;
|
|
892
|
-
const MAX_DISTANCE = 3.5;
|
|
893
890
|
/**
|
|
894
891
|
* 空间游走标签插件
|
|
895
892
|
*/
|
|
896
893
|
const PanoSpatialTagPlugin = (five$1, params) => {
|
|
897
|
-
var _a, _b, _c, _d, _e, _f;
|
|
894
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
898
895
|
let wrapper = params === null || params === void 0 ? void 0 : params.container;
|
|
896
|
+
let centerY = 1.4;
|
|
899
897
|
const wait = (_a = params === null || params === void 0 ? void 0 : params.wait) !== null && _a !== void 0 ? _a : 200;
|
|
900
898
|
const maxNumberOnScreen = (_b = params === null || params === void 0 ? void 0 : params.maxNumberOnScreen) !== null && _b !== void 0 ? _b : 3;
|
|
901
899
|
const minRad = (_c = params === null || params === void 0 ? void 0 : params.minRad) !== null && _c !== void 0 ? _c : Math.PI / 4;
|
|
902
900
|
const nearTolerance = (_d = params === null || params === void 0 ? void 0 : params.nearTolerance) !== null && _d !== void 0 ? _d : 100;
|
|
903
901
|
const upsideHeight = (_e = params === null || params === void 0 ? void 0 : params.upsideHeight) !== null && _e !== void 0 ? _e : 1.6;
|
|
902
|
+
const minDistance = (_f = params === null || params === void 0 ? void 0 : params.minDistance) !== null && _f !== void 0 ? _f : 1.2;
|
|
903
|
+
const maxDistance = (_g = params === null || params === void 0 ? void 0 : params.maxDistance) !== null && _g !== void 0 ? _g : 3.5;
|
|
904
904
|
// const foldPercent = params?.foldPercent ?? 20
|
|
905
905
|
const css3DRender = CSS3DRenderPlugin(five$1);
|
|
906
906
|
const container = document.createElement('div');
|
|
@@ -954,8 +954,8 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
954
954
|
projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
|
|
955
955
|
frustum.setFromProjectionMatrix(projScreenMatrix);
|
|
956
956
|
state.tags.forEach(tag => {
|
|
957
|
-
const distance = camera.position.clone().setY(
|
|
958
|
-
if (distance <
|
|
957
|
+
const distance = camera.position.clone().setY(centerY).distanceTo(tag.position);
|
|
958
|
+
if (distance < minDistance || distance > maxDistance)
|
|
959
959
|
return tag.destroying = true;
|
|
960
960
|
if (!frustum.containsPoint(tag.position))
|
|
961
961
|
return tag.destroying = true;
|
|
@@ -967,16 +967,16 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
967
967
|
state.tags.forEach(tag => {
|
|
968
968
|
if (tag.destroying) {
|
|
969
969
|
tag.app.$set({
|
|
970
|
-
contentZoom: 0.1 + camera.position.distanceTo(tag.position) /
|
|
971
|
-
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) /
|
|
970
|
+
contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
|
|
971
|
+
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
|
|
972
972
|
destroying: tag.destroying,
|
|
973
973
|
});
|
|
974
974
|
}
|
|
975
975
|
else {
|
|
976
976
|
tag.app.$set({
|
|
977
|
-
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) /
|
|
978
|
-
lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) -
|
|
979
|
-
contentZoom: 0.1 + camera.position.distanceTo(tag.position) /
|
|
977
|
+
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
|
|
978
|
+
lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) - minDistance) / maxDistance * 0.6,
|
|
979
|
+
contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
|
|
980
980
|
});
|
|
981
981
|
}
|
|
982
982
|
});
|
|
@@ -1049,8 +1049,8 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
1049
1049
|
const points = state.points.reduce((result, point) => {
|
|
1050
1050
|
if (state.tags.find(tag => point.id === tag.id && !tag.destroying))
|
|
1051
1051
|
return result;
|
|
1052
|
-
const distance = camera.position.clone().setY(
|
|
1053
|
-
if (distance <
|
|
1052
|
+
const distance = camera.position.clone().setY(centerY).distanceTo(point.position);
|
|
1053
|
+
if (distance < minDistance || distance > maxDistance)
|
|
1054
1054
|
return result;
|
|
1055
1055
|
if (!frustum.containsPoint(point.position))
|
|
1056
1056
|
return result;
|
|
@@ -1110,10 +1110,12 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
1110
1110
|
Math.pow((mouse.y - _mouse.y) / 2 * clientHeight, 2)) > nearTolerance;
|
|
1111
1111
|
}))
|
|
1112
1112
|
continue;
|
|
1113
|
-
const raycaster = new THREE__namespace.Raycaster(camera.position.clone().setY(
|
|
1114
|
-
const [intersect] =
|
|
1115
|
-
|
|
1116
|
-
|
|
1113
|
+
const raycaster = new THREE__namespace.Raycaster(camera.position.clone().setY(centerY), point.position.clone().sub(camera.position.clone().setY(centerY)).normalize(), 0, point.distance + RAY_TOLERANT_DISTANCE);
|
|
1114
|
+
const [intersect] = state.intersectObjects ?
|
|
1115
|
+
raycaster.intersectObjects(state.intersectObjects, true) :
|
|
1116
|
+
(five$1.model.bvhs.loaded ?
|
|
1117
|
+
five$1.model.intersectRaycaster(raycaster) :
|
|
1118
|
+
raycaster.intersectObjects(five$1.model.children, true));
|
|
1117
1119
|
if (!intersect)
|
|
1118
1120
|
continue;
|
|
1119
1121
|
if (point.distance - intersect.distance < RAY_TOLERANT_DISTANCE) {
|
|
@@ -1133,9 +1135,9 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
1133
1135
|
props: {
|
|
1134
1136
|
id,
|
|
1135
1137
|
content: state.render(state.template, replacement),
|
|
1136
|
-
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) /
|
|
1137
|
-
lineHeightZoom: 0.4 + (camera.position.distanceTo(position) -
|
|
1138
|
-
contentZoom: 0.1 + camera.position.distanceTo(position) /
|
|
1138
|
+
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) / maxDistance),
|
|
1139
|
+
lineHeightZoom: 0.4 + (camera.position.distanceTo(position) - minDistance) / maxDistance * 0.6,
|
|
1140
|
+
contentZoom: 0.1 + camera.position.distanceTo(position) / maxDistance,
|
|
1139
1141
|
upsideDown: position.y > upsideHeight,
|
|
1140
1142
|
folded: state.folded,
|
|
1141
1143
|
events: state.events,
|
|
@@ -1180,6 +1182,13 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
1180
1182
|
if (data.folded === true)
|
|
1181
1183
|
state.folded = data.folded;
|
|
1182
1184
|
};
|
|
1185
|
+
/** 设置射线碰撞检测objects
|
|
1186
|
+
*
|
|
1187
|
+
*/
|
|
1188
|
+
const setIntersectObjects = (objects) => {
|
|
1189
|
+
state.intersectObjects = objects;
|
|
1190
|
+
updateTags();
|
|
1191
|
+
};
|
|
1183
1192
|
/** 标签启用
|
|
1184
1193
|
* 启用插件并重新计算展示标签
|
|
1185
1194
|
*/
|
|
@@ -1239,6 +1248,22 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
1239
1248
|
tag.app.$set({ folded: true });
|
|
1240
1249
|
});
|
|
1241
1250
|
};
|
|
1251
|
+
const onResize = () => {
|
|
1252
|
+
five$1.once('renderFrame', updateOrigins);
|
|
1253
|
+
};
|
|
1254
|
+
const onModelLoaded = () => {
|
|
1255
|
+
if (!wrapper)
|
|
1256
|
+
wrapper = five$1.getElement().parentElement;
|
|
1257
|
+
if (wrapper)
|
|
1258
|
+
wrapper.appendChild(container);
|
|
1259
|
+
state.forbidden = false;
|
|
1260
|
+
centerY = five$1.model.bounding.getCenter(new THREE__namespace.Vector3()).y;
|
|
1261
|
+
updateTags();
|
|
1262
|
+
five$1.on('panoWillArrive', onPanoWillArrive);
|
|
1263
|
+
five$1.on('panoArrived', onPanoArrived);
|
|
1264
|
+
five$1.on('modeChange', onModeChange);
|
|
1265
|
+
five$1.on('cameraUpdate', onCameraUpdate);
|
|
1266
|
+
};
|
|
1242
1267
|
const dispose = () => {
|
|
1243
1268
|
blurImage = null;
|
|
1244
1269
|
css3DRender.disposeAll();
|
|
@@ -1249,40 +1274,24 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
1249
1274
|
});
|
|
1250
1275
|
state.origins = [];
|
|
1251
1276
|
state.tags = [];
|
|
1277
|
+
five$1.off('modelLoaded', onModelLoaded);
|
|
1278
|
+
five$1.off('renderFrame', updateOrigins);
|
|
1252
1279
|
five$1.off('panoWillArrive', onPanoWillArrive);
|
|
1253
1280
|
five$1.off('panoArrived', onPanoArrived);
|
|
1254
1281
|
five$1.off('modeChange', onModeChange);
|
|
1255
1282
|
five$1.off('cameraUpdate', onCameraUpdate);
|
|
1283
|
+
five$1.off('dispose', dispose);
|
|
1284
|
+
window.removeEventListener('resize', onResize, false);
|
|
1256
1285
|
};
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
state.forbidden = false;
|
|
1263
|
-
updateTags();
|
|
1264
|
-
five$1.on('panoWillArrive', onPanoWillArrive);
|
|
1265
|
-
five$1.on('panoArrived', onPanoArrived);
|
|
1266
|
-
five$1.on('modeChange', onModeChange);
|
|
1267
|
-
five$1.on('cameraUpdate', onCameraUpdate);
|
|
1268
|
-
}
|
|
1269
|
-
else {
|
|
1270
|
-
five$1.once('modelLoaded', () => {
|
|
1271
|
-
if (!wrapper)
|
|
1272
|
-
wrapper = five$1.getElement().parentElement;
|
|
1273
|
-
if (wrapper)
|
|
1274
|
-
wrapper.appendChild(container);
|
|
1275
|
-
state.forbidden = false;
|
|
1276
|
-
updateTags();
|
|
1277
|
-
five$1.on('panoWillArrive', onPanoWillArrive);
|
|
1278
|
-
five$1.on('panoArrived', onPanoArrived);
|
|
1279
|
-
five$1.on('modeChange', onModeChange);
|
|
1280
|
-
five$1.on('cameraUpdate', onCameraUpdate);
|
|
1281
|
-
});
|
|
1282
|
-
}
|
|
1286
|
+
window.addEventListener('resize', onResize, false);
|
|
1287
|
+
if ((_h = five$1 === null || five$1 === void 0 ? void 0 : five$1.model) === null || _h === void 0 ? void 0 : _h.loaded)
|
|
1288
|
+
onModelLoaded();
|
|
1289
|
+
else
|
|
1290
|
+
five$1.once('modelLoaded', onModelLoaded);
|
|
1283
1291
|
five$1.on('dispose', dispose);
|
|
1284
1292
|
return {
|
|
1285
1293
|
load,
|
|
1294
|
+
setIntersectObjects,
|
|
1286
1295
|
unfoldAll,
|
|
1287
1296
|
foldAll,
|
|
1288
1297
|
unfold,
|
package/dist/index.es.js
CHANGED
|
@@ -11964,7 +11964,7 @@ function create_fragment$4(ctx) {
|
|
|
11964
11964
|
div3 = element("div");
|
|
11965
11965
|
div2 = element("div");
|
|
11966
11966
|
attr(div0, "class", "PanoSpatialTagPlugin__tag-shadow svelte-eb8bdm");
|
|
11967
|
-
set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
|
|
11967
|
+
set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
|
|
11968
11968
|
attr(i0, "class", "PanoSpatialTagPlugin__tag-flagpole svelte-eb8bdm");
|
|
11969
11969
|
set_style(i0, "width", /*lineWidthZoom*/ ctx[4] + "rem");
|
|
11970
11970
|
attr(i1, "class", "PanoSpatialTagPlugin__tag-line1 svelte-eb8bdm");
|
|
@@ -12004,7 +12004,7 @@ function create_fragment$4(ctx) {
|
|
|
12004
12004
|
},
|
|
12005
12005
|
p(ctx, [dirty]) {
|
|
12006
12006
|
if (dirty & /*contentWidth, contentZoom, contentHeight, upsideDown*/ 394) {
|
|
12007
|
-
set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
|
|
12007
|
+
set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
|
|
12008
12008
|
}
|
|
12009
12009
|
|
|
12010
12010
|
if (dirty & /*lineWidthZoom*/ 16) {
|
|
@@ -12426,22 +12426,22 @@ class Template {
|
|
|
12426
12426
|
}
|
|
12427
12427
|
|
|
12428
12428
|
const MESH_SIZE = 0.001;
|
|
12429
|
-
const RAY_ORIGIN_Y = 1.4;
|
|
12430
12429
|
const RAY_TOLERANT_DISTANCE = 0.01;
|
|
12431
12430
|
const BLUR_IMAGE_URL = 'https://vrlab-image4.ljcdn.com/release/web/PanoSpatialTagPlugin__blur.png';
|
|
12432
|
-
const MIN_DISTANCE = 1.2;
|
|
12433
|
-
const MAX_DISTANCE = 3.5;
|
|
12434
12431
|
/**
|
|
12435
12432
|
* 空间游走标签插件
|
|
12436
12433
|
*/
|
|
12437
12434
|
const PanoSpatialTagPlugin = (five, params) => {
|
|
12438
|
-
var _a, _b, _c, _d, _e, _f;
|
|
12435
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
12439
12436
|
let wrapper = params === null || params === void 0 ? void 0 : params.container;
|
|
12437
|
+
let centerY = 1.4;
|
|
12440
12438
|
const wait = (_a = params === null || params === void 0 ? void 0 : params.wait) !== null && _a !== void 0 ? _a : 200;
|
|
12441
12439
|
const maxNumberOnScreen = (_b = params === null || params === void 0 ? void 0 : params.maxNumberOnScreen) !== null && _b !== void 0 ? _b : 3;
|
|
12442
12440
|
const minRad = (_c = params === null || params === void 0 ? void 0 : params.minRad) !== null && _c !== void 0 ? _c : Math.PI / 4;
|
|
12443
12441
|
const nearTolerance = (_d = params === null || params === void 0 ? void 0 : params.nearTolerance) !== null && _d !== void 0 ? _d : 100;
|
|
12444
12442
|
const upsideHeight = (_e = params === null || params === void 0 ? void 0 : params.upsideHeight) !== null && _e !== void 0 ? _e : 1.6;
|
|
12443
|
+
const minDistance = (_f = params === null || params === void 0 ? void 0 : params.minDistance) !== null && _f !== void 0 ? _f : 1.2;
|
|
12444
|
+
const maxDistance = (_g = params === null || params === void 0 ? void 0 : params.maxDistance) !== null && _g !== void 0 ? _g : 3.5;
|
|
12445
12445
|
// const foldPercent = params?.foldPercent ?? 20
|
|
12446
12446
|
const css3DRender = CSS3DRenderPlugin(five);
|
|
12447
12447
|
const container = document.createElement('div');
|
|
@@ -12495,8 +12495,8 @@ const PanoSpatialTagPlugin = (five, params) => {
|
|
|
12495
12495
|
projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
|
|
12496
12496
|
frustum.setFromProjectionMatrix(projScreenMatrix);
|
|
12497
12497
|
state.tags.forEach(tag => {
|
|
12498
|
-
const distance = camera.position.clone().setY(
|
|
12499
|
-
if (distance <
|
|
12498
|
+
const distance = camera.position.clone().setY(centerY).distanceTo(tag.position);
|
|
12499
|
+
if (distance < minDistance || distance > maxDistance)
|
|
12500
12500
|
return tag.destroying = true;
|
|
12501
12501
|
if (!frustum.containsPoint(tag.position))
|
|
12502
12502
|
return tag.destroying = true;
|
|
@@ -12508,16 +12508,16 @@ const PanoSpatialTagPlugin = (five, params) => {
|
|
|
12508
12508
|
state.tags.forEach(tag => {
|
|
12509
12509
|
if (tag.destroying) {
|
|
12510
12510
|
tag.app.$set({
|
|
12511
|
-
contentZoom: 0.1 + camera.position.distanceTo(tag.position) /
|
|
12512
|
-
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) /
|
|
12511
|
+
contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
|
|
12512
|
+
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
|
|
12513
12513
|
destroying: tag.destroying,
|
|
12514
12514
|
});
|
|
12515
12515
|
}
|
|
12516
12516
|
else {
|
|
12517
12517
|
tag.app.$set({
|
|
12518
|
-
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) /
|
|
12519
|
-
lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) -
|
|
12520
|
-
contentZoom: 0.1 + camera.position.distanceTo(tag.position) /
|
|
12518
|
+
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
|
|
12519
|
+
lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) - minDistance) / maxDistance * 0.6,
|
|
12520
|
+
contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
|
|
12521
12521
|
});
|
|
12522
12522
|
}
|
|
12523
12523
|
});
|
|
@@ -12590,8 +12590,8 @@ const PanoSpatialTagPlugin = (five, params) => {
|
|
|
12590
12590
|
const points = state.points.reduce((result, point) => {
|
|
12591
12591
|
if (state.tags.find(tag => point.id === tag.id && !tag.destroying))
|
|
12592
12592
|
return result;
|
|
12593
|
-
const distance = camera.position.clone().setY(
|
|
12594
|
-
if (distance <
|
|
12593
|
+
const distance = camera.position.clone().setY(centerY).distanceTo(point.position);
|
|
12594
|
+
if (distance < minDistance || distance > maxDistance)
|
|
12595
12595
|
return result;
|
|
12596
12596
|
if (!frustum.containsPoint(point.position))
|
|
12597
12597
|
return result;
|
|
@@ -12651,10 +12651,12 @@ const PanoSpatialTagPlugin = (five, params) => {
|
|
|
12651
12651
|
Math.pow((mouse.y - _mouse.y) / 2 * clientHeight, 2)) > nearTolerance;
|
|
12652
12652
|
}))
|
|
12653
12653
|
continue;
|
|
12654
|
-
const raycaster = new THREE.Raycaster(camera.position.clone().setY(
|
|
12655
|
-
const [intersect] =
|
|
12656
|
-
|
|
12657
|
-
|
|
12654
|
+
const raycaster = new THREE.Raycaster(camera.position.clone().setY(centerY), point.position.clone().sub(camera.position.clone().setY(centerY)).normalize(), 0, point.distance + RAY_TOLERANT_DISTANCE);
|
|
12655
|
+
const [intersect] = state.intersectObjects ?
|
|
12656
|
+
raycaster.intersectObjects(state.intersectObjects, true) :
|
|
12657
|
+
(five.model.bvhs.loaded ?
|
|
12658
|
+
five.model.intersectRaycaster(raycaster) :
|
|
12659
|
+
raycaster.intersectObjects(five.model.children, true));
|
|
12658
12660
|
if (!intersect)
|
|
12659
12661
|
continue;
|
|
12660
12662
|
if (point.distance - intersect.distance < RAY_TOLERANT_DISTANCE) {
|
|
@@ -12674,9 +12676,9 @@ const PanoSpatialTagPlugin = (five, params) => {
|
|
|
12674
12676
|
props: {
|
|
12675
12677
|
id,
|
|
12676
12678
|
content: state.render(state.template, replacement),
|
|
12677
|
-
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) /
|
|
12678
|
-
lineHeightZoom: 0.4 + (camera.position.distanceTo(position) -
|
|
12679
|
-
contentZoom: 0.1 + camera.position.distanceTo(position) /
|
|
12679
|
+
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) / maxDistance),
|
|
12680
|
+
lineHeightZoom: 0.4 + (camera.position.distanceTo(position) - minDistance) / maxDistance * 0.6,
|
|
12681
|
+
contentZoom: 0.1 + camera.position.distanceTo(position) / maxDistance,
|
|
12680
12682
|
upsideDown: position.y > upsideHeight,
|
|
12681
12683
|
folded: state.folded,
|
|
12682
12684
|
events: state.events,
|
|
@@ -12721,6 +12723,13 @@ const PanoSpatialTagPlugin = (five, params) => {
|
|
|
12721
12723
|
if (data.folded === true)
|
|
12722
12724
|
state.folded = data.folded;
|
|
12723
12725
|
};
|
|
12726
|
+
/** 设置射线碰撞检测objects
|
|
12727
|
+
*
|
|
12728
|
+
*/
|
|
12729
|
+
const setIntersectObjects = (objects) => {
|
|
12730
|
+
state.intersectObjects = objects;
|
|
12731
|
+
updateTags();
|
|
12732
|
+
};
|
|
12724
12733
|
/** 标签启用
|
|
12725
12734
|
* 启用插件并重新计算展示标签
|
|
12726
12735
|
*/
|
|
@@ -12780,6 +12789,22 @@ const PanoSpatialTagPlugin = (five, params) => {
|
|
|
12780
12789
|
tag.app.$set({ folded: true });
|
|
12781
12790
|
});
|
|
12782
12791
|
};
|
|
12792
|
+
const onResize = () => {
|
|
12793
|
+
five.once('renderFrame', updateOrigins);
|
|
12794
|
+
};
|
|
12795
|
+
const onModelLoaded = () => {
|
|
12796
|
+
if (!wrapper)
|
|
12797
|
+
wrapper = five.getElement().parentElement;
|
|
12798
|
+
if (wrapper)
|
|
12799
|
+
wrapper.appendChild(container);
|
|
12800
|
+
state.forbidden = false;
|
|
12801
|
+
centerY = five.model.bounding.getCenter(new THREE.Vector3()).y;
|
|
12802
|
+
updateTags();
|
|
12803
|
+
five.on('panoWillArrive', onPanoWillArrive);
|
|
12804
|
+
five.on('panoArrived', onPanoArrived);
|
|
12805
|
+
five.on('modeChange', onModeChange);
|
|
12806
|
+
five.on('cameraUpdate', onCameraUpdate);
|
|
12807
|
+
};
|
|
12783
12808
|
const dispose = () => {
|
|
12784
12809
|
blurImage = null;
|
|
12785
12810
|
css3DRender.disposeAll();
|
|
@@ -12790,40 +12815,24 @@ const PanoSpatialTagPlugin = (five, params) => {
|
|
|
12790
12815
|
});
|
|
12791
12816
|
state.origins = [];
|
|
12792
12817
|
state.tags = [];
|
|
12818
|
+
five.off('modelLoaded', onModelLoaded);
|
|
12819
|
+
five.off('renderFrame', updateOrigins);
|
|
12793
12820
|
five.off('panoWillArrive', onPanoWillArrive);
|
|
12794
12821
|
five.off('panoArrived', onPanoArrived);
|
|
12795
12822
|
five.off('modeChange', onModeChange);
|
|
12796
12823
|
five.off('cameraUpdate', onCameraUpdate);
|
|
12824
|
+
five.off('dispose', dispose);
|
|
12825
|
+
window.removeEventListener('resize', onResize, false);
|
|
12797
12826
|
};
|
|
12798
|
-
|
|
12799
|
-
|
|
12800
|
-
|
|
12801
|
-
|
|
12802
|
-
|
|
12803
|
-
state.forbidden = false;
|
|
12804
|
-
updateTags();
|
|
12805
|
-
five.on('panoWillArrive', onPanoWillArrive);
|
|
12806
|
-
five.on('panoArrived', onPanoArrived);
|
|
12807
|
-
five.on('modeChange', onModeChange);
|
|
12808
|
-
five.on('cameraUpdate', onCameraUpdate);
|
|
12809
|
-
}
|
|
12810
|
-
else {
|
|
12811
|
-
five.once('modelLoaded', () => {
|
|
12812
|
-
if (!wrapper)
|
|
12813
|
-
wrapper = five.getElement().parentElement;
|
|
12814
|
-
if (wrapper)
|
|
12815
|
-
wrapper.appendChild(container);
|
|
12816
|
-
state.forbidden = false;
|
|
12817
|
-
updateTags();
|
|
12818
|
-
five.on('panoWillArrive', onPanoWillArrive);
|
|
12819
|
-
five.on('panoArrived', onPanoArrived);
|
|
12820
|
-
five.on('modeChange', onModeChange);
|
|
12821
|
-
five.on('cameraUpdate', onCameraUpdate);
|
|
12822
|
-
});
|
|
12823
|
-
}
|
|
12827
|
+
window.addEventListener('resize', onResize, false);
|
|
12828
|
+
if ((_h = five === null || five === void 0 ? void 0 : five.model) === null || _h === void 0 ? void 0 : _h.loaded)
|
|
12829
|
+
onModelLoaded();
|
|
12830
|
+
else
|
|
12831
|
+
five.once('modelLoaded', onModelLoaded);
|
|
12824
12832
|
five.on('dispose', dispose);
|
|
12825
12833
|
return {
|
|
12826
12834
|
load,
|
|
12835
|
+
setIntersectObjects,
|
|
12827
12836
|
unfoldAll,
|
|
12828
12837
|
foldAll,
|
|
12829
12838
|
unfold,
|
package/dist/index.js
CHANGED
|
@@ -11992,7 +11992,7 @@ function create_fragment$4(ctx) {
|
|
|
11992
11992
|
div3 = internal.element("div");
|
|
11993
11993
|
div2 = internal.element("div");
|
|
11994
11994
|
internal.attr(div0, "class", "PanoSpatialTagPlugin__tag-shadow svelte-eb8bdm");
|
|
11995
|
-
internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
|
|
11995
|
+
internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
|
|
11996
11996
|
internal.attr(i0, "class", "PanoSpatialTagPlugin__tag-flagpole svelte-eb8bdm");
|
|
11997
11997
|
internal.set_style(i0, "width", /*lineWidthZoom*/ ctx[4] + "rem");
|
|
11998
11998
|
internal.attr(i1, "class", "PanoSpatialTagPlugin__tag-line1 svelte-eb8bdm");
|
|
@@ -12032,7 +12032,7 @@ function create_fragment$4(ctx) {
|
|
|
12032
12032
|
},
|
|
12033
12033
|
p(ctx, [dirty]) {
|
|
12034
12034
|
if (dirty & /*contentWidth, contentZoom, contentHeight, upsideDown*/ 394) {
|
|
12035
|
-
internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
|
|
12035
|
+
internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
|
|
12036
12036
|
}
|
|
12037
12037
|
|
|
12038
12038
|
if (dirty & /*lineWidthZoom*/ 16) {
|
|
@@ -12454,22 +12454,22 @@ class Template {
|
|
|
12454
12454
|
}
|
|
12455
12455
|
|
|
12456
12456
|
const MESH_SIZE = 0.001;
|
|
12457
|
-
const RAY_ORIGIN_Y = 1.4;
|
|
12458
12457
|
const RAY_TOLERANT_DISTANCE = 0.01;
|
|
12459
12458
|
const BLUR_IMAGE_URL = 'https://vrlab-image4.ljcdn.com/release/web/PanoSpatialTagPlugin__blur.png';
|
|
12460
|
-
const MIN_DISTANCE = 1.2;
|
|
12461
|
-
const MAX_DISTANCE = 3.5;
|
|
12462
12459
|
/**
|
|
12463
12460
|
* 空间游走标签插件
|
|
12464
12461
|
*/
|
|
12465
12462
|
const PanoSpatialTagPlugin = (five$1, params) => {
|
|
12466
|
-
var _a, _b, _c, _d, _e, _f;
|
|
12463
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
12467
12464
|
let wrapper = params === null || params === void 0 ? void 0 : params.container;
|
|
12465
|
+
let centerY = 1.4;
|
|
12468
12466
|
const wait = (_a = params === null || params === void 0 ? void 0 : params.wait) !== null && _a !== void 0 ? _a : 200;
|
|
12469
12467
|
const maxNumberOnScreen = (_b = params === null || params === void 0 ? void 0 : params.maxNumberOnScreen) !== null && _b !== void 0 ? _b : 3;
|
|
12470
12468
|
const minRad = (_c = params === null || params === void 0 ? void 0 : params.minRad) !== null && _c !== void 0 ? _c : Math.PI / 4;
|
|
12471
12469
|
const nearTolerance = (_d = params === null || params === void 0 ? void 0 : params.nearTolerance) !== null && _d !== void 0 ? _d : 100;
|
|
12472
12470
|
const upsideHeight = (_e = params === null || params === void 0 ? void 0 : params.upsideHeight) !== null && _e !== void 0 ? _e : 1.6;
|
|
12471
|
+
const minDistance = (_f = params === null || params === void 0 ? void 0 : params.minDistance) !== null && _f !== void 0 ? _f : 1.2;
|
|
12472
|
+
const maxDistance = (_g = params === null || params === void 0 ? void 0 : params.maxDistance) !== null && _g !== void 0 ? _g : 3.5;
|
|
12473
12473
|
// const foldPercent = params?.foldPercent ?? 20
|
|
12474
12474
|
const css3DRender = CSS3DRenderPlugin(five$1);
|
|
12475
12475
|
const container = document.createElement('div');
|
|
@@ -12523,8 +12523,8 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
12523
12523
|
projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
|
|
12524
12524
|
frustum.setFromProjectionMatrix(projScreenMatrix);
|
|
12525
12525
|
state.tags.forEach(tag => {
|
|
12526
|
-
const distance = camera.position.clone().setY(
|
|
12527
|
-
if (distance <
|
|
12526
|
+
const distance = camera.position.clone().setY(centerY).distanceTo(tag.position);
|
|
12527
|
+
if (distance < minDistance || distance > maxDistance)
|
|
12528
12528
|
return tag.destroying = true;
|
|
12529
12529
|
if (!frustum.containsPoint(tag.position))
|
|
12530
12530
|
return tag.destroying = true;
|
|
@@ -12536,16 +12536,16 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
12536
12536
|
state.tags.forEach(tag => {
|
|
12537
12537
|
if (tag.destroying) {
|
|
12538
12538
|
tag.app.$set({
|
|
12539
|
-
contentZoom: 0.1 + camera.position.distanceTo(tag.position) /
|
|
12540
|
-
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) /
|
|
12539
|
+
contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
|
|
12540
|
+
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
|
|
12541
12541
|
destroying: tag.destroying,
|
|
12542
12542
|
});
|
|
12543
12543
|
}
|
|
12544
12544
|
else {
|
|
12545
12545
|
tag.app.$set({
|
|
12546
|
-
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) /
|
|
12547
|
-
lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) -
|
|
12548
|
-
contentZoom: 0.1 + camera.position.distanceTo(tag.position) /
|
|
12546
|
+
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
|
|
12547
|
+
lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) - minDistance) / maxDistance * 0.6,
|
|
12548
|
+
contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
|
|
12549
12549
|
});
|
|
12550
12550
|
}
|
|
12551
12551
|
});
|
|
@@ -12618,8 +12618,8 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
12618
12618
|
const points = state.points.reduce((result, point) => {
|
|
12619
12619
|
if (state.tags.find(tag => point.id === tag.id && !tag.destroying))
|
|
12620
12620
|
return result;
|
|
12621
|
-
const distance = camera.position.clone().setY(
|
|
12622
|
-
if (distance <
|
|
12621
|
+
const distance = camera.position.clone().setY(centerY).distanceTo(point.position);
|
|
12622
|
+
if (distance < minDistance || distance > maxDistance)
|
|
12623
12623
|
return result;
|
|
12624
12624
|
if (!frustum.containsPoint(point.position))
|
|
12625
12625
|
return result;
|
|
@@ -12679,10 +12679,12 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
12679
12679
|
Math.pow((mouse.y - _mouse.y) / 2 * clientHeight, 2)) > nearTolerance;
|
|
12680
12680
|
}))
|
|
12681
12681
|
continue;
|
|
12682
|
-
const raycaster = new THREE__namespace.Raycaster(camera.position.clone().setY(
|
|
12683
|
-
const [intersect] =
|
|
12684
|
-
|
|
12685
|
-
|
|
12682
|
+
const raycaster = new THREE__namespace.Raycaster(camera.position.clone().setY(centerY), point.position.clone().sub(camera.position.clone().setY(centerY)).normalize(), 0, point.distance + RAY_TOLERANT_DISTANCE);
|
|
12683
|
+
const [intersect] = state.intersectObjects ?
|
|
12684
|
+
raycaster.intersectObjects(state.intersectObjects, true) :
|
|
12685
|
+
(five$1.model.bvhs.loaded ?
|
|
12686
|
+
five$1.model.intersectRaycaster(raycaster) :
|
|
12687
|
+
raycaster.intersectObjects(five$1.model.children, true));
|
|
12686
12688
|
if (!intersect)
|
|
12687
12689
|
continue;
|
|
12688
12690
|
if (point.distance - intersect.distance < RAY_TOLERANT_DISTANCE) {
|
|
@@ -12702,9 +12704,9 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
12702
12704
|
props: {
|
|
12703
12705
|
id,
|
|
12704
12706
|
content: state.render(state.template, replacement),
|
|
12705
|
-
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) /
|
|
12706
|
-
lineHeightZoom: 0.4 + (camera.position.distanceTo(position) -
|
|
12707
|
-
contentZoom: 0.1 + camera.position.distanceTo(position) /
|
|
12707
|
+
lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) / maxDistance),
|
|
12708
|
+
lineHeightZoom: 0.4 + (camera.position.distanceTo(position) - minDistance) / maxDistance * 0.6,
|
|
12709
|
+
contentZoom: 0.1 + camera.position.distanceTo(position) / maxDistance,
|
|
12708
12710
|
upsideDown: position.y > upsideHeight,
|
|
12709
12711
|
folded: state.folded,
|
|
12710
12712
|
events: state.events,
|
|
@@ -12749,6 +12751,13 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
12749
12751
|
if (data.folded === true)
|
|
12750
12752
|
state.folded = data.folded;
|
|
12751
12753
|
};
|
|
12754
|
+
/** 设置射线碰撞检测objects
|
|
12755
|
+
*
|
|
12756
|
+
*/
|
|
12757
|
+
const setIntersectObjects = (objects) => {
|
|
12758
|
+
state.intersectObjects = objects;
|
|
12759
|
+
updateTags();
|
|
12760
|
+
};
|
|
12752
12761
|
/** 标签启用
|
|
12753
12762
|
* 启用插件并重新计算展示标签
|
|
12754
12763
|
*/
|
|
@@ -12808,6 +12817,22 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
12808
12817
|
tag.app.$set({ folded: true });
|
|
12809
12818
|
});
|
|
12810
12819
|
};
|
|
12820
|
+
const onResize = () => {
|
|
12821
|
+
five$1.once('renderFrame', updateOrigins);
|
|
12822
|
+
};
|
|
12823
|
+
const onModelLoaded = () => {
|
|
12824
|
+
if (!wrapper)
|
|
12825
|
+
wrapper = five$1.getElement().parentElement;
|
|
12826
|
+
if (wrapper)
|
|
12827
|
+
wrapper.appendChild(container);
|
|
12828
|
+
state.forbidden = false;
|
|
12829
|
+
centerY = five$1.model.bounding.getCenter(new THREE__namespace.Vector3()).y;
|
|
12830
|
+
updateTags();
|
|
12831
|
+
five$1.on('panoWillArrive', onPanoWillArrive);
|
|
12832
|
+
five$1.on('panoArrived', onPanoArrived);
|
|
12833
|
+
five$1.on('modeChange', onModeChange);
|
|
12834
|
+
five$1.on('cameraUpdate', onCameraUpdate);
|
|
12835
|
+
};
|
|
12811
12836
|
const dispose = () => {
|
|
12812
12837
|
blurImage = null;
|
|
12813
12838
|
css3DRender.disposeAll();
|
|
@@ -12818,40 +12843,24 @@ const PanoSpatialTagPlugin = (five$1, params) => {
|
|
|
12818
12843
|
});
|
|
12819
12844
|
state.origins = [];
|
|
12820
12845
|
state.tags = [];
|
|
12846
|
+
five$1.off('modelLoaded', onModelLoaded);
|
|
12847
|
+
five$1.off('renderFrame', updateOrigins);
|
|
12821
12848
|
five$1.off('panoWillArrive', onPanoWillArrive);
|
|
12822
12849
|
five$1.off('panoArrived', onPanoArrived);
|
|
12823
12850
|
five$1.off('modeChange', onModeChange);
|
|
12824
12851
|
five$1.off('cameraUpdate', onCameraUpdate);
|
|
12852
|
+
five$1.off('dispose', dispose);
|
|
12853
|
+
window.removeEventListener('resize', onResize, false);
|
|
12825
12854
|
};
|
|
12826
|
-
|
|
12827
|
-
|
|
12828
|
-
|
|
12829
|
-
|
|
12830
|
-
|
|
12831
|
-
state.forbidden = false;
|
|
12832
|
-
updateTags();
|
|
12833
|
-
five$1.on('panoWillArrive', onPanoWillArrive);
|
|
12834
|
-
five$1.on('panoArrived', onPanoArrived);
|
|
12835
|
-
five$1.on('modeChange', onModeChange);
|
|
12836
|
-
five$1.on('cameraUpdate', onCameraUpdate);
|
|
12837
|
-
}
|
|
12838
|
-
else {
|
|
12839
|
-
five$1.once('modelLoaded', () => {
|
|
12840
|
-
if (!wrapper)
|
|
12841
|
-
wrapper = five$1.getElement().parentElement;
|
|
12842
|
-
if (wrapper)
|
|
12843
|
-
wrapper.appendChild(container);
|
|
12844
|
-
state.forbidden = false;
|
|
12845
|
-
updateTags();
|
|
12846
|
-
five$1.on('panoWillArrive', onPanoWillArrive);
|
|
12847
|
-
five$1.on('panoArrived', onPanoArrived);
|
|
12848
|
-
five$1.on('modeChange', onModeChange);
|
|
12849
|
-
five$1.on('cameraUpdate', onCameraUpdate);
|
|
12850
|
-
});
|
|
12851
|
-
}
|
|
12855
|
+
window.addEventListener('resize', onResize, false);
|
|
12856
|
+
if ((_h = five$1 === null || five$1 === void 0 ? void 0 : five$1.model) === null || _h === void 0 ? void 0 : _h.loaded)
|
|
12857
|
+
onModelLoaded();
|
|
12858
|
+
else
|
|
12859
|
+
five$1.once('modelLoaded', onModelLoaded);
|
|
12852
12860
|
five$1.on('dispose', dispose);
|
|
12853
12861
|
return {
|
|
12854
12862
|
load,
|
|
12863
|
+
setIntersectObjects,
|
|
12855
12864
|
unfoldAll,
|
|
12856
12865
|
foldAll,
|
|
12857
12866
|
unfold,
|