@realsee/dnalogel 2.0.0-alpha.43 → 2.0.0-alpha.44
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/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/CameraMovementPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/ItemLabelPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/ItemLabelPlugin/index.js +138 -73
- package/dist/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/ModelChassisCompassPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/ModelEntryDoorGuidePlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/ModelItemLabelPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/ModelRoomLabelPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/ModelTVVideoPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/ModelViewPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/PanoCompassPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/PanoCursorRaycasterPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/PanoMeasurePlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/PanoRulerPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/PanoRulerProPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/PanoSpatialTagPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/floorplan/ModelFloorplanPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/floorplan/PanoFloorplanRadarPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/floorplan/TopviewFloorplanPlugin/ItemLabelPlugin/typings.d.ts +1 -0
- package/dist/index.es.js +156 -91
- package/dist/index.js +156 -91
- package/dist/index.umd.js +156 -91
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- package/docs/enums/CameraMovementEffect.html +1 -1
- 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/Rotation.html +1 -1
- package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
- package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/FloorplanBounding.html +3 -3
- package/docs/interfaces/FloorplanData.html +1 -1
- package/docs/interfaces/FloorplanEntrance.html +6 -6
- package/docs/interfaces/FloorplanExtraObject.html +2 -2
- package/docs/interfaces/FloorplanExtraObject3D.html +1 -1
- package/docs/interfaces/FloorplanFloorData.html +1 -1
- package/docs/interfaces/FloorplanImagePosition.html +1 -1
- package/docs/interfaces/FloorplanObserver.html +1 -1
- package/docs/interfaces/FloorplanOutlineItem.html +1 -1
- package/docs/interfaces/FloorplanPosition.html +1 -1
- package/docs/interfaces/FloorplanRoomItem.html +5 -5
- package/docs/interfaces/FloorplanRoomLabelItem.html +2 -2
- package/docs/interfaces/FloorplanServerBounding.html +3 -3
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +1 -1
- package/docs/interfaces/FloorplanServerEntrance.html +6 -6
- package/docs/interfaces/FloorplanServerFloorData.html +1 -1
- package/docs/interfaces/FloorplanServerImagePosition.html +1 -1
- package/docs/interfaces/FloorplanServerObserver.html +1 -1
- package/docs/interfaces/FloorplanServerOutlineItem.html +1 -1
- package/docs/interfaces/FloorplanServerPosition.html +1 -1
- package/docs/interfaces/FloorplanServerRoomItem.html +6 -6
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +2 -2
- 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/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 +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- 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/PanoRulerProPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginState.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/modules.html +18 -18
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +2 -2
- package/libs/ItemLabelPlugin/ItemLabelComponent.svelte +251 -0
- package/libs/ItemLabelPlugin/ItemLabelItem.js +141 -74
- package/libs/ItemLabelPlugin/ItemLabelItem.svelte +180 -0
- package/libs/ItemLabelPlugin/Plugin.js +1 -1
- package/libs/ItemLabelPlugin/typings.d.ts +3 -1
- package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +2 -2
- package/libs/ModelItemLabelPlugin/ItemLabelComponent.svelte +155 -0
- package/libs/ModelItemLabelPlugin/ItemLabelItem.js +6 -6
- package/libs/ModelItemLabelPlugin/ItemLabelItem.svelte +100 -0
- package/libs/ModelItemLabelPlugin/ModelItemLabelPlugin.js +1 -1
- package/libs/ModelItemLabelPlugin/typings.d.ts +1 -1
- package/libs/ModelRoomLabelPlugin/Controller.js +1 -1
- package/libs/ModelRoomLabelPlugin/RoomLabelItem.js +4 -4
- package/libs/ModelRoomLabelPlugin/RoomLabelItem.svelte +63 -0
- package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +2 -2
- package/libs/ModelRoomLabelPlugin/RoomLabelItems.svelte +94 -0
- package/libs/PanoRulerProPlugin/Controller.js +1 -1
- package/libs/PanoRulerProPlugin/RulerItem.js +9 -9
- package/libs/PanoRulerProPlugin/RulerItem.svelte +166 -0
- package/libs/PanoRulerProPlugin/RulerItems.svelte +212 -0
- package/libs/PanoSpatialTagPlugin/Components/origins.js +2 -2
- package/libs/PanoSpatialTagPlugin/Components/origins.svelte +58 -0
- package/libs/PanoSpatialTagPlugin/Components/tag.js +9 -9
- package/libs/PanoSpatialTagPlugin/Components/tag.svelte +292 -0
- package/libs/PanoSpatialTagPlugin/Plugin.js +2 -2
- package/libs/floorplan/Components/BaseImage.js +2 -2
- package/libs/floorplan/Components/BaseImage.svelte +26 -0
- package/libs/floorplan/Components/Camera.js +3 -3
- package/libs/floorplan/Components/Camera.svelte +46 -0
- package/libs/floorplan/Components/Compass.js +4 -4
- package/libs/floorplan/Components/Compass.svelte +51 -0
- package/libs/floorplan/Components/CurrentFloor.js +3 -3
- package/libs/floorplan/Components/CurrentFloor.svelte +46 -0
- package/libs/floorplan/Components/Main.js +2 -2
- package/libs/floorplan/Components/Main.svelte +51 -0
- package/libs/floorplan/Components/Normalmage.js +2 -2
- package/libs/floorplan/Components/Normalmage.svelte +11 -0
- package/libs/floorplan/Components/RoomHighlight/Room.js +2 -2
- package/libs/floorplan/Components/RoomHighlight/Room.svelte +27 -0
- package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -3
- package/libs/floorplan/Components/RoomHighlight/RoomHighlight.svelte +29 -0
- package/libs/floorplan/Components/RoomLabels/RoomLabel.js +3 -3
- package/libs/floorplan/Components/RoomLabels/RoomLabel.svelte +119 -0
- package/libs/floorplan/Components/RoomLabels/RoomLabels.js +2 -2
- package/libs/floorplan/Components/RoomLabels/RoomLabels.svelte +35 -0
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +3 -3
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.svelte +42 -0
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_0.svelte +7 -0
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_1.svelte +24 -0
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial_2.svelte +33 -0
- package/libs/floorplan/Components/RuleLabels/RuleItem.js +9 -9
- package/libs/floorplan/Components/RuleLabels/RuleItem.svelte +174 -0
- package/libs/floorplan/Components/RuleLabels/RuleLabels.js +2 -2
- package/libs/floorplan/Components/RuleLabels/RuleLabels.svelte +32 -0
- package/libs/floorplan/Components/SvgImage.js +3 -4
- package/libs/floorplan/Components/SvgImage.svelte +28 -0
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +1 -1
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Camera.js +4 -4
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Camera.svelte +85 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.svelte +18 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/ExtraObjects.js +4 -4
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/ExtraObjects.svelte +40 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Main.js +3 -3
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Main.svelte +64 -0
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +1 -1
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script>import { onDestroy } from 'svelte';
|
|
2
|
+
import { Raycaster, Vector3 } from 'three';
|
|
3
|
+
import RoomLabelItem from './RoomLabelItem.svelte';
|
|
4
|
+
export let five;
|
|
5
|
+
export let roomLabels;
|
|
6
|
+
let containerWidth;
|
|
7
|
+
let containerHeight;
|
|
8
|
+
let shownFloor = null;
|
|
9
|
+
$: rendererSize = { x: containerWidth, y: containerHeight };
|
|
10
|
+
$: {
|
|
11
|
+
// rendererSize 变化时,触发 reRender
|
|
12
|
+
roomLabels = getFormatedRoomLabels(rendererSize);
|
|
13
|
+
}
|
|
14
|
+
$: {
|
|
15
|
+
// shownFloor 变化时,更新 item visible
|
|
16
|
+
roomLabels = roomLabels.map((item) => {
|
|
17
|
+
const isLabelInFloor = shownFloor === null || item.floorIndex === shownFloor;
|
|
18
|
+
const visible = isLabelInFloor ? item.visible : false;
|
|
19
|
+
return Object.assign(Object.assign({}, item), { visible });
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function getLabelVisible(item) {
|
|
23
|
+
const raycaster = new Raycaster();
|
|
24
|
+
const cameraPosition = five.camera.position.clone();
|
|
25
|
+
const position = new Vector3(item.position.x, item.position.y, item.position.z);
|
|
26
|
+
const vectorDistance = position.distanceTo(cameraPosition);
|
|
27
|
+
raycaster.set(cameraPosition.clone(), position.clone().sub(cameraPosition).normalize());
|
|
28
|
+
const [intersection] = five.model.intersectRaycaster(raycaster);
|
|
29
|
+
if (intersection && intersection.distance + 1 < vectorDistance)
|
|
30
|
+
return false;
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
function getLabelTransform(item, rendererSize) {
|
|
34
|
+
const position = new Vector3(item.position.x, item.position.y, item.position.z);
|
|
35
|
+
const mouse = position.clone().project(five.camera);
|
|
36
|
+
const xOffset = Math.ceil(((mouse.x + 1) / 2) * rendererSize.x);
|
|
37
|
+
const yOffset = Math.ceil(((-mouse.y + 1) / 2) * rendererSize.y);
|
|
38
|
+
return `translate(${xOffset}px, ${yOffset}px)`;
|
|
39
|
+
}
|
|
40
|
+
function getFormatedRoomLabels(rendererSize) {
|
|
41
|
+
// 因为 item distance 需要重复计算,所以缓存一下
|
|
42
|
+
const distanceMap = new Map();
|
|
43
|
+
function getItemDistance(item) {
|
|
44
|
+
const cacheDistance = distanceMap.get(item.id);
|
|
45
|
+
if (cacheDistance)
|
|
46
|
+
return cacheDistance;
|
|
47
|
+
const { x, y, z } = item.position;
|
|
48
|
+
const distance = new Vector3(x, y, z).clone().distanceTo(five.camera.position);
|
|
49
|
+
distanceMap.set(item.id, distance);
|
|
50
|
+
return distance;
|
|
51
|
+
}
|
|
52
|
+
const formatedItems = roomLabels.map((item) => {
|
|
53
|
+
const visible = getLabelVisible(item);
|
|
54
|
+
const transform = visible ? getLabelTransform(item, rendererSize) : item.transform;
|
|
55
|
+
const itemDistance = getItemDistance(item);
|
|
56
|
+
// visible === true 的 item 中,distance 比自己小的 item 个数
|
|
57
|
+
const minItemLen = roomLabels.filter((item) => item.visible && getItemDistance(item) < itemDistance).length;
|
|
58
|
+
const zIndex = minItemLen * 10;
|
|
59
|
+
return Object.assign(Object.assign({}, item), { visible, transform, zIndex });
|
|
60
|
+
});
|
|
61
|
+
return formatedItems;
|
|
62
|
+
}
|
|
63
|
+
function onFiveCameraUpdate() {
|
|
64
|
+
roomLabels = getFormatedRoomLabels(rendererSize);
|
|
65
|
+
}
|
|
66
|
+
function onFiveModelShownFloorChange(floorIndex) {
|
|
67
|
+
shownFloor = floorIndex;
|
|
68
|
+
}
|
|
69
|
+
five.on('cameraUpdate', onFiveCameraUpdate);
|
|
70
|
+
five.on('modelShownFloorChange', onFiveModelShownFloorChange);
|
|
71
|
+
onDestroy(() => {
|
|
72
|
+
five.off('cameraUpdate', onFiveCameraUpdate);
|
|
73
|
+
five.off('modelShownFloorChange', onFiveModelShownFloorChange);
|
|
74
|
+
});
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<div
|
|
78
|
+
class="room-labels-container"
|
|
79
|
+
bind:clientWidth="{containerWidth}"
|
|
80
|
+
bind:clientHeight="{containerHeight}"
|
|
81
|
+
>
|
|
82
|
+
{#each roomLabels as roomLableItem (roomLableItem.id)}
|
|
83
|
+
<RoomLabelItem roomLabel="{roomLableItem}" five="{five}" />
|
|
84
|
+
{/each}
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<style>
|
|
88
|
+
.room-labels-container {
|
|
89
|
+
width: 100%;
|
|
90
|
+
height: 100%;
|
|
91
|
+
position: relative;
|
|
92
|
+
color: #fff;
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from "svelte/internal";
|
|
22
22
|
|
|
23
23
|
function add_css(target) {
|
|
24
|
-
append_styles(target, "svelte-
|
|
24
|
+
append_styles(target, "svelte-qy4ud2", ".PanoRulerPlugin-rule-line.svelte-qy4ud2.svelte-qy4ud2{position:absolute;transform-origin:left 0.0625rem;width:0;height:0.125rem;pointer-events:none}.PanoRulerPlugin-rule-line.svelte-qy4ud2.svelte-qy4ud2::after{content:'';position:absolute;left:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;-webkit-animation:svelte-qy4ud2-viewport-rule-point 0.1s 1s;animation:svelte-qy4ud2-viewport-rule-point 0.1s 1s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-qy4ud2.svelte-qy4ud2::before{content:'';position:absolute;right:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;-webkit-animation:svelte-qy4ud2-viewport-rule-point 0.1s 1.5s;animation:svelte-qy4ud2-viewport-rule-point 0.1s 1.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-qy4ud2 em.svelte-qy4ud2{display:block;height:0.0625rem;-webkit-animation:svelte-qy4ud2-viewport-rule-line 0.5s ease 1s;animation:svelte-qy4ud2-viewport-rule-line 0.5s ease 1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;box-shadow:0 0 0.25rem rgb(0 0 0 / 40%);position:relative}.rule-mixed-line.svelte-qy4ud2.svelte-qy4ud2{display:flex;height:0.0625rem;-webkit-animation:svelte-qy4ud2-viewport-rule-line 0.5s ease 1s;animation:svelte-qy4ud2-viewport-rule-line 0.5s ease 1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;align-items:center}.em-solid.svelte-qy4ud2.svelte-qy4ud2{height:100%;background:#ffffff}.em-dotted.svelte-qy4ud2.svelte-qy4ud2{height:0.125rem;background:var(--background-image);background-position:center;background-repeat:repeat}.PanoRulerPlugin-rule-label.svelte-qy4ud2.svelte-qy4ud2{position:absolute;width:0;height:0;top:0.0625rem;pointer-events:none}.PanoRulerPlugin-rule-label-name.svelte-qy4ud2.svelte-qy4ud2{position:absolute;padding:0.1875rem 0.375rem;background:rgba(195, 195, 195, 0.3);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem);border-radius:6.25rem;border:0.0625rem solid rgba(255, 255, 255, 0.6);white-space:nowrap;overflow:hidden;color:#ffffff;font-weight:500;font-size:0.75rem;line-height:1;-webkit-animation:svelte-qy4ud2-viewport-rule-label 0.25s ease 1s;animation:svelte-qy4ud2-viewport-rule-label 0.25s ease 1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;box-shadow:inset 0 0 0.625rem 0 rgba(255, 255, 255, 0.3)}@-webkit-keyframes svelte-qy4ud2-viewport-rule-line{0%{width:0%}100%{width:100%}}@keyframes svelte-qy4ud2-viewport-rule-line{0%{width:0%}100%{width:100%}}@-webkit-keyframes svelte-qy4ud2-viewport-rule-label{0%{opacity:0;transform:scaleX(0)}100%{opacity:1;transform:translate(-50%, -50%) scaleX(1)}}@keyframes svelte-qy4ud2-viewport-rule-label{0%{opacity:0;transform:scaleX(0)}100%{opacity:1;transform:translate(-50%, -50%) scaleX(1)}}@-webkit-keyframes svelte-qy4ud2-viewport-rule-point{0%{transform:scaleX(0)}100%{transform:scaleX(1)}}@keyframes svelte-qy4ud2-viewport-rule-point{0%{transform:scaleX(0)}100%{transform:scaleX(1)}}");
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function get_each_context(ctx, list, i) {
|
|
@@ -48,7 +48,7 @@ function create_else_block(ctx) {
|
|
|
48
48
|
each_blocks[i].c();
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
attr(div, "class", "rule-mixed-line svelte-
|
|
51
|
+
attr(div, "class", "rule-mixed-line svelte-qy4ud2");
|
|
52
52
|
},
|
|
53
53
|
m(target, anchor) {
|
|
54
54
|
insert(target, div, anchor);
|
|
@@ -99,7 +99,7 @@ function create_if_block(ctx) {
|
|
|
99
99
|
|
|
100
100
|
attr(em, "class", em_class_value = "" + (null_to_empty(/*rulerItemProp*/ ctx[0].state
|
|
101
101
|
? 'em-solid'
|
|
102
|
-
: 'em-dotted') + " svelte-
|
|
102
|
+
: 'em-dotted') + " svelte-qy4ud2"));
|
|
103
103
|
|
|
104
104
|
attr(em, "style", /*vars*/ ctx[3]);
|
|
105
105
|
},
|
|
@@ -109,7 +109,7 @@ function create_if_block(ctx) {
|
|
|
109
109
|
p(ctx, dirty) {
|
|
110
110
|
if (dirty & /*rulerItemProp*/ 1 && em_class_value !== (em_class_value = "" + (null_to_empty(/*rulerItemProp*/ ctx[0].state
|
|
111
111
|
? 'em-solid'
|
|
112
|
-
: 'em-dotted') + " svelte-
|
|
112
|
+
: 'em-dotted') + " svelte-qy4ud2"))) {
|
|
113
113
|
attr(em, "class", em_class_value);
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -132,7 +132,7 @@ function create_each_block(ctx) {
|
|
|
132
132
|
return {
|
|
133
133
|
c() {
|
|
134
134
|
div = element("div");
|
|
135
|
-
attr(div, "class", div_class_value = "" + (null_to_empty(/*child*/ ctx[6].state ? 'em-solid' : 'em-dotted') + " svelte-
|
|
135
|
+
attr(div, "class", div_class_value = "" + (null_to_empty(/*child*/ ctx[6].state ? 'em-solid' : 'em-dotted') + " svelte-qy4ud2"));
|
|
136
136
|
attr(div, "style", /*vars*/ ctx[3]);
|
|
137
137
|
set_style(div, "width", style_width, false);
|
|
138
138
|
},
|
|
@@ -140,7 +140,7 @@ function create_each_block(ctx) {
|
|
|
140
140
|
insert(target, div, anchor);
|
|
141
141
|
},
|
|
142
142
|
p(ctx, dirty) {
|
|
143
|
-
if (dirty & /*rulerItemProp*/ 1 && div_class_value !== (div_class_value = "" + (null_to_empty(/*child*/ ctx[6].state ? 'em-solid' : 'em-dotted') + " svelte-
|
|
143
|
+
if (dirty & /*rulerItemProp*/ 1 && div_class_value !== (div_class_value = "" + (null_to_empty(/*child*/ ctx[6].state ? 'em-solid' : 'em-dotted') + " svelte-qy4ud2"))) {
|
|
144
144
|
attr(div, "class", div_class_value);
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -188,11 +188,11 @@ function create_fragment(ctx) {
|
|
|
188
188
|
div1 = element("div");
|
|
189
189
|
div0 = element("div");
|
|
190
190
|
t1 = text(t1_value);
|
|
191
|
-
attr(div0, "class", "PanoRulerPlugin-rule-label-name svelte-
|
|
191
|
+
attr(div0, "class", "PanoRulerPlugin-rule-label-name svelte-qy4ud2");
|
|
192
192
|
add_render_callback(() => /*div0_elementresize_handler*/ ctx[4].call(div0));
|
|
193
|
-
attr(div1, "class", "PanoRulerPlugin-rule-label svelte-
|
|
193
|
+
attr(div1, "class", "PanoRulerPlugin-rule-label svelte-qy4ud2");
|
|
194
194
|
set_style(div1, "left", style_left, false);
|
|
195
|
-
attr(div2, "class", "PanoRulerPlugin-rule-line svelte-
|
|
195
|
+
attr(div2, "class", "PanoRulerPlugin-rule-line svelte-qy4ud2");
|
|
196
196
|
set_style(div2, "width", style_width, false);
|
|
197
197
|
set_style(div2, "left", style_left_1, false);
|
|
198
198
|
set_style(div2, "top", style_top, false);
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<script>export let rulerItemProp;
|
|
2
|
+
let _visible = true;
|
|
3
|
+
let labelWidth;
|
|
4
|
+
$: {
|
|
5
|
+
if (labelWidth >= rulerItemProp.width ||
|
|
6
|
+
labelWidth / 2 >= (rulerItemProp.labelOffset / 100) * rulerItemProp.width ||
|
|
7
|
+
labelWidth / 2 >= (1 - rulerItemProp.labelOffset / 100) * rulerItemProp.width) {
|
|
8
|
+
_visible = false;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
_visible = true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
let EM_DOTTED_BG = `data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PGZpbHRlciBpZD0icHJlZml4X19hIiBoZWlnaHQ9IjQwMCUiIHdpZHRoPSIxMzcuNCUiIHg9Ii0xOC43JSIgeT0iLTE1MCUiPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiBvcGVyYXRvcj0iZGlsYXRlIiByYWRpdXM9Ii41IiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSIvPjxmZU9mZnNldCBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiByYWRpdXM9IjEiIHJlc3VsdD0ic2hhZG93SW5uZXIiLz48ZmVPZmZzZXQgaW49InNoYWRvd0lubmVyIiByZXN1bHQ9InNoYWRvd0lubmVyIi8+PGZlQ29tcG9zaXRlIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIGluMj0ic2hhZG93SW5uZXIiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIi8+PGZlR2F1c3NpYW5CbHVyIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIgc3RkRGV2aWF0aW9uPSIuNSIvPjxmZUNvbG9yTWF0cml4IGluPSJzaGFkb3dCbHVyT3V0ZXIxIiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMiAwIi8+PC9maWx0ZXI+PHBhdGggaWQ9InByZWZpeF9fYiIgZD0iTS44ODkgMkgxMS41OCIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1kYXNoYXJyYXk9IjUgNiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48dXNlIGZpbGw9IiMwMDAiIGZpbHRlcj0idXJsKCNwcmVmaXhfX2EpIiB4bGluazpocmVmPSIjcHJlZml4X19iIi8+PHVzZSBzdHJva2U9IiNmZmYiIHN0cm9rZS1vcGFjaXR5PSIuNCIgeGxpbms6aHJlZj0iI3ByZWZpeF9fYiIvPjwvZz48L3N2Zz4=`;
|
|
15
|
+
$: vars = `--background-image: url(${EM_DOTTED_BG})`;
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<div
|
|
19
|
+
class="PanoRulerPlugin-rule-line"
|
|
20
|
+
style:width="{rulerItemProp.width}px"
|
|
21
|
+
style:left="{rulerItemProp.left}px"
|
|
22
|
+
style:top="{rulerItemProp.top}px"
|
|
23
|
+
style:transform="rotate({rulerItemProp.rotateDeg}deg)"
|
|
24
|
+
style:display="{rulerItemProp.visible && _visible ? 'block' : 'none'}"
|
|
25
|
+
>
|
|
26
|
+
{#if rulerItemProp.children.length === 0}
|
|
27
|
+
<em class="{rulerItemProp.state ? 'em-solid' : 'em-dotted'}" style="{vars}"></em>
|
|
28
|
+
{:else}
|
|
29
|
+
<div class="rule-mixed-line">
|
|
30
|
+
{#each rulerItemProp.children as child}
|
|
31
|
+
<div style:width="{child.width}px" class="{child.state ? 'em-solid' : 'em-dotted'}" style="{vars}"></div>
|
|
32
|
+
{/each}
|
|
33
|
+
</div>
|
|
34
|
+
{/if}
|
|
35
|
+
<div
|
|
36
|
+
class="PanoRulerPlugin-rule-label"
|
|
37
|
+
style:left="{rulerItemProp.labelOffset}%"
|
|
38
|
+
>
|
|
39
|
+
<div class="PanoRulerPlugin-rule-label-name" bind:offsetWidth="{labelWidth}">
|
|
40
|
+
{rulerItemProp.labelElement}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<style>
|
|
46
|
+
.PanoRulerPlugin-rule-line {
|
|
47
|
+
position: absolute;
|
|
48
|
+
transform-origin: left 0.0625rem;
|
|
49
|
+
width: 0;
|
|
50
|
+
height: 0.125rem;
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.PanoRulerPlugin-rule-line::after {
|
|
55
|
+
content: '';
|
|
56
|
+
position: absolute;
|
|
57
|
+
left: -0.125rem;
|
|
58
|
+
top: -0.1rem;
|
|
59
|
+
width: 0.25rem;
|
|
60
|
+
height: 0.25rem;
|
|
61
|
+
border-radius: 50%;
|
|
62
|
+
background: #fff;
|
|
63
|
+
z-index: 1;
|
|
64
|
+
animation: viewport-rule-point 0.1s 1s;
|
|
65
|
+
animation-fill-mode: both;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.PanoRulerPlugin-rule-line::before {
|
|
69
|
+
content: '';
|
|
70
|
+
position: absolute;
|
|
71
|
+
right: -0.125rem;
|
|
72
|
+
top: -0.1rem;
|
|
73
|
+
width: 0.25rem;
|
|
74
|
+
height: 0.25rem;
|
|
75
|
+
border-radius: 50%;
|
|
76
|
+
background: #fff;
|
|
77
|
+
z-index: 1;
|
|
78
|
+
animation: viewport-rule-point 0.1s 1.5s;
|
|
79
|
+
animation-fill-mode: both;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.PanoRulerPlugin-rule-line em {
|
|
83
|
+
display: block;
|
|
84
|
+
height: 0.0625rem;
|
|
85
|
+
animation: viewport-rule-line 0.5s ease 1s;
|
|
86
|
+
animation-fill-mode: both;
|
|
87
|
+
box-shadow: 0 0 0.25rem rgb(0 0 0 / 40%);
|
|
88
|
+
position: relative;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.rule-mixed-line {
|
|
92
|
+
display: flex;
|
|
93
|
+
height: 0.0625rem;
|
|
94
|
+
animation: viewport-rule-line 0.5s ease 1s;
|
|
95
|
+
animation-fill-mode: both;
|
|
96
|
+
align-items: center;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.em-solid {
|
|
100
|
+
height: 100%;
|
|
101
|
+
background: #ffffff;
|
|
102
|
+
}
|
|
103
|
+
.em-dotted {
|
|
104
|
+
height: 0.125rem;
|
|
105
|
+
background: var(--background-image);
|
|
106
|
+
background-position: center;
|
|
107
|
+
background-repeat: repeat;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.PanoRulerPlugin-rule-label {
|
|
111
|
+
position: absolute;
|
|
112
|
+
width: 0;
|
|
113
|
+
height: 0;
|
|
114
|
+
top: 0.0625rem;
|
|
115
|
+
pointer-events: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.PanoRulerPlugin-rule-label-name {
|
|
119
|
+
position: absolute;
|
|
120
|
+
padding: 0.1875rem 0.375rem;
|
|
121
|
+
background: rgba(195, 195, 195, 0.3);
|
|
122
|
+
backdrop-filter: blur(0.25rem);
|
|
123
|
+
-webkit-backdrop-filter: blur(0.25rem);
|
|
124
|
+
border-radius: 6.25rem;
|
|
125
|
+
border: 0.0625rem solid rgba(255, 255, 255, 0.6);
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
overflow: hidden;
|
|
128
|
+
color: #ffffff;
|
|
129
|
+
font-weight: 500;
|
|
130
|
+
font-size: 0.75rem;
|
|
131
|
+
line-height: 1;
|
|
132
|
+
-webkit-animation: viewport-rule-label 0.25s ease 1s;
|
|
133
|
+
animation: viewport-rule-label 0.25s ease 1s;
|
|
134
|
+
animation-fill-mode: both;
|
|
135
|
+
box-shadow: inset 0 0 0.625rem 0 rgba(255, 255, 255, 0.3);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@keyframes viewport-rule-line {
|
|
139
|
+
0% {
|
|
140
|
+
width: 0%;
|
|
141
|
+
}
|
|
142
|
+
100% {
|
|
143
|
+
width: 100%;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@keyframes viewport-rule-label {
|
|
148
|
+
0% {
|
|
149
|
+
opacity: 0;
|
|
150
|
+
transform: scaleX(0);
|
|
151
|
+
}
|
|
152
|
+
100% {
|
|
153
|
+
opacity: 1;
|
|
154
|
+
transform: translate(-50%, -50%) scaleX(1);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@keyframes viewport-rule-point {
|
|
159
|
+
0% {
|
|
160
|
+
transform: scaleX(0);
|
|
161
|
+
}
|
|
162
|
+
100% {
|
|
163
|
+
transform: scaleX(1);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
</style>
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<script>var _a, _b, _c, _d;
|
|
2
|
+
import { Five } from '@realsee/five';
|
|
3
|
+
import { nextFrame } from '../shared-utils/animationFrame';
|
|
4
|
+
import equal from '../shared-utils/equal';
|
|
5
|
+
import { intersectionOfLine } from '../shared-utils/math/planimetry';
|
|
6
|
+
import throttle from '../shared-utils/throttle';
|
|
7
|
+
import { onDestroy, onMount } from 'svelte';
|
|
8
|
+
import { Vector3 } from 'three';
|
|
9
|
+
import RulerItem from './RulerItem.svelte';
|
|
10
|
+
export let five;
|
|
11
|
+
export let rulerDatas;
|
|
12
|
+
export let options;
|
|
13
|
+
let rulerItemProp = [];
|
|
14
|
+
const canvasWidth = ((_b = (_a = five.getElement()) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.clientWidth) || 0;
|
|
15
|
+
const canvasHeight = ((_d = (_c = five.getElement()) === null || _c === void 0 ? void 0 : _c.parentElement) === null || _d === void 0 ? void 0 : _d.clientHeight) || 0;
|
|
16
|
+
const getRuleScreenIntr = (startPoint, endPoint) => {
|
|
17
|
+
const screenLines = [
|
|
18
|
+
[
|
|
19
|
+
{ x: 0, y: 0 },
|
|
20
|
+
{ x: canvasWidth, y: 0 },
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
{ x: 0, y: 0 },
|
|
24
|
+
{ x: 0, y: canvasHeight },
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
{ x: canvasWidth, y: 0 },
|
|
28
|
+
{ x: canvasWidth, y: canvasHeight },
|
|
29
|
+
],
|
|
30
|
+
[
|
|
31
|
+
{ x: 0, y: canvasHeight },
|
|
32
|
+
{ x: canvasWidth, y: canvasHeight },
|
|
33
|
+
],
|
|
34
|
+
];
|
|
35
|
+
const intr = [];
|
|
36
|
+
for (let i = 0; i < screenLines.length; i++) {
|
|
37
|
+
const result = intersectionOfLine([startPoint, endPoint], [screenLines[i][0], screenLines[i][1]], true);
|
|
38
|
+
if (result)
|
|
39
|
+
intr.push(result);
|
|
40
|
+
}
|
|
41
|
+
if (intr.length === 0)
|
|
42
|
+
return false;
|
|
43
|
+
else {
|
|
44
|
+
return intr;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const getPosition = (start, end) => {
|
|
48
|
+
const startPoint = start.clone().project(five.camera);
|
|
49
|
+
const startLeft = ((startPoint.x + 1) / 2) * canvasWidth;
|
|
50
|
+
const startTop = ((-startPoint.y + 1) / 2) * canvasHeight;
|
|
51
|
+
const endPoint = end.clone().project(five.camera);
|
|
52
|
+
const endLeft = ((endPoint.x + 1) / 2) * canvasWidth;
|
|
53
|
+
const endTop = ((-endPoint.y + 1) / 2) * canvasHeight;
|
|
54
|
+
const distance = Math.sqrt(Math.pow(endLeft - startLeft, 2) + Math.pow(endTop - startTop, 2));
|
|
55
|
+
return {
|
|
56
|
+
startLeft,
|
|
57
|
+
startTop,
|
|
58
|
+
endLeft,
|
|
59
|
+
endTop,
|
|
60
|
+
distance,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const getPositionAndVisible = (start, end, visibleOrigin) => {
|
|
64
|
+
const cameraPosition = five.camera.position;
|
|
65
|
+
const cameraDirection = five.camera.getWorldDirection(new Vector3());
|
|
66
|
+
const startAngle = start.clone().sub(cameraPosition).normalize().angleTo(cameraDirection);
|
|
67
|
+
const endAngle = end.clone().sub(cameraPosition).normalize().angleTo(cameraDirection);
|
|
68
|
+
const ruleLength = start.distanceTo(end);
|
|
69
|
+
const midPoint = end.clone().sub(end.clone().sub(start).divide(new Vector3(2, 2, 2)));
|
|
70
|
+
const disFromCameraToMid = midPoint.distanceTo(cameraPosition);
|
|
71
|
+
const { startLeft, startTop, endLeft, endTop, distance } = getPosition(start, end);
|
|
72
|
+
const rad = Math.PI / 2 - Math.atan2(endLeft - startLeft, startTop - endTop);
|
|
73
|
+
const deg = -(rad / Math.PI) * 180;
|
|
74
|
+
let visible = true;
|
|
75
|
+
if (!visibleOrigin)
|
|
76
|
+
visible = false;
|
|
77
|
+
// 只显示拐点相连的线
|
|
78
|
+
if (!equal(start, visibleOrigin) && !equal(end, visibleOrigin)) {
|
|
79
|
+
visible = false;
|
|
80
|
+
}
|
|
81
|
+
// 线小于0.3m隐藏
|
|
82
|
+
if (ruleLength < 0.3) {
|
|
83
|
+
visible = false;
|
|
84
|
+
}
|
|
85
|
+
if (startAngle > Math.PI / 2) {
|
|
86
|
+
visible = false;
|
|
87
|
+
}
|
|
88
|
+
if (endAngle > Math.PI / 2) {
|
|
89
|
+
visible = false;
|
|
90
|
+
}
|
|
91
|
+
if (disFromCameraToMid / ruleLength > 8) {
|
|
92
|
+
visible = false;
|
|
93
|
+
}
|
|
94
|
+
let labelOffset = 50;
|
|
95
|
+
let visibleLength = distance;
|
|
96
|
+
const intr = getRuleScreenIntr({ x: ~~startLeft, y: ~~startTop }, { x: ~~endLeft, y: ~~endTop });
|
|
97
|
+
if (intr && intr.length === 1) {
|
|
98
|
+
if (equal(start, visibleOrigin)) {
|
|
99
|
+
visibleLength = Math.sqrt(Math.pow(intr[0].x - startLeft, 2) + Math.pow(intr[0].y - startTop, 2));
|
|
100
|
+
labelOffset = (visibleLength / distance) * 50;
|
|
101
|
+
}
|
|
102
|
+
else if (equal(end, visibleOrigin)) {
|
|
103
|
+
visibleLength = Math.sqrt(Math.pow(intr[0].x - endLeft, 2) + Math.pow(intr[0].y - endTop, 2));
|
|
104
|
+
labelOffset = 100 - (visibleLength / distance) * 50;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (intr && intr.length === 2) {
|
|
108
|
+
const middlePoint = {
|
|
109
|
+
x: (intr[0].x + intr[1].x) / 2,
|
|
110
|
+
y: (intr[0].y + intr[1].y) / 2,
|
|
111
|
+
};
|
|
112
|
+
const distanceFromStart = Math.sqrt(Math.pow(middlePoint.x - startLeft, 2) + Math.pow(middlePoint.y - startTop, 2));
|
|
113
|
+
labelOffset = (distanceFromStart / distance) * 100;
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
startLeft,
|
|
117
|
+
startTop,
|
|
118
|
+
distance,
|
|
119
|
+
deg,
|
|
120
|
+
visible,
|
|
121
|
+
labelOffset,
|
|
122
|
+
ruleLength,
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
const updatePanoRulerData = () => {
|
|
126
|
+
const panoIndex = five.panoIndex;
|
|
127
|
+
const rulerData = rulerDatas.find((data) => data.panoIndex === panoIndex);
|
|
128
|
+
if (!rulerData)
|
|
129
|
+
return (rulerItemProp = []);
|
|
130
|
+
// 非全景模式下隐藏所有标尺
|
|
131
|
+
if (five.currentMode !== Five.Mode.Panorama)
|
|
132
|
+
return (rulerItemProp = []);
|
|
133
|
+
const cameraPosition = five.camera.position;
|
|
134
|
+
const cameraDirection = five.camera.getWorldDirection(new Vector3());
|
|
135
|
+
const startPoints = rulerData.lines.map((v) => new Vector3(v.start[0], -v.start[1], -v.start[2]));
|
|
136
|
+
const endPoints = rulerData.lines.map((v) => new Vector3(v.end[0], -v.end[1], -v.end[2]));
|
|
137
|
+
// 可以看到的角度最小的拐点
|
|
138
|
+
const [visibleOrigin] = startPoints.concat(endPoints).sort((pointA, pointB) => {
|
|
139
|
+
const angleA = pointA
|
|
140
|
+
.clone()
|
|
141
|
+
.setY(0)
|
|
142
|
+
.sub(cameraPosition)
|
|
143
|
+
.normalize()
|
|
144
|
+
.angleTo(cameraDirection.clone().setY(0));
|
|
145
|
+
const angleB = pointB
|
|
146
|
+
.clone()
|
|
147
|
+
.setY(0)
|
|
148
|
+
.sub(cameraPosition)
|
|
149
|
+
.normalize()
|
|
150
|
+
.angleTo(cameraDirection.clone().setY(0));
|
|
151
|
+
return angleA - angleB;
|
|
152
|
+
});
|
|
153
|
+
const data = rulerData.lines.map((line) => {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
const start = line.start;
|
|
156
|
+
const end = line.end;
|
|
157
|
+
const { startLeft, startTop, distance, deg, visible, labelOffset, ruleLength } = getPositionAndVisible(new Vector3(start[0], -start[1], -start[2]), new Vector3(end[0], -end[1], -end[2]), visibleOrigin);
|
|
158
|
+
const children = [];
|
|
159
|
+
if (line.children && ((_a = line.children) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
160
|
+
(_b = line.children) === null || _b === void 0 ? void 0 : _b.forEach((l) => {
|
|
161
|
+
const start = l.start;
|
|
162
|
+
const end = l.end;
|
|
163
|
+
const { distance } = getPosition(new Vector3(start[0], -start[1], -start[2]), new Vector3(end[0], -end[1], -end[2]));
|
|
164
|
+
children.push({
|
|
165
|
+
width: distance,
|
|
166
|
+
state: l.state,
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
width: distance,
|
|
172
|
+
left: startLeft,
|
|
173
|
+
top: startTop,
|
|
174
|
+
rotateDeg: deg,
|
|
175
|
+
state: line.state,
|
|
176
|
+
children,
|
|
177
|
+
labelOffset,
|
|
178
|
+
visible,
|
|
179
|
+
labelElement: options.distanceText(ruleLength),
|
|
180
|
+
};
|
|
181
|
+
});
|
|
182
|
+
rulerItemProp = data;
|
|
183
|
+
};
|
|
184
|
+
const nextFrameFreshRule = () => nextFrame(updatePanoRulerData);
|
|
185
|
+
const throttleFreshRule = throttle(updatePanoRulerData, 80);
|
|
186
|
+
onMount(() => {
|
|
187
|
+
updatePanoRulerData();
|
|
188
|
+
five.on('panoArrived', updatePanoRulerData);
|
|
189
|
+
five.on('modeChange', updatePanoRulerData);
|
|
190
|
+
five.on('cameraDirectionUpdate', nextFrameFreshRule);
|
|
191
|
+
five.on('movingToPano', nextFrameFreshRule);
|
|
192
|
+
five.on('mouseWheel', () => throttleFreshRule());
|
|
193
|
+
five.on('pinchGesture', () => throttleFreshRule());
|
|
194
|
+
});
|
|
195
|
+
onDestroy(() => {
|
|
196
|
+
five.off('panoArrived', updatePanoRulerData);
|
|
197
|
+
five.off('modeChange', updatePanoRulerData);
|
|
198
|
+
five.off('cameraDirectionUpdate', nextFrameFreshRule);
|
|
199
|
+
five.off('movingToPano', nextFrameFreshRule);
|
|
200
|
+
five.off('mouseWheel', () => throttleFreshRule());
|
|
201
|
+
five.off('pinchGesture', () => throttleFreshRule());
|
|
202
|
+
});
|
|
203
|
+
</script>
|
|
204
|
+
|
|
205
|
+
<div>
|
|
206
|
+
{#each rulerItemProp as itemData}
|
|
207
|
+
<RulerItem rulerItemProp="{itemData}" />
|
|
208
|
+
{/each}
|
|
209
|
+
</div>
|
|
210
|
+
|
|
211
|
+
<style>
|
|
212
|
+
</style>
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import { currentTarget } from '../store';
|
|
20
20
|
|
|
21
21
|
function add_css(target) {
|
|
22
|
-
append_styles(target, "svelte-
|
|
22
|
+
append_styles(target, "svelte-1kuu68s", ".PanoSpatialTagPlugin__tag-origin.svelte-1kuu68s{position:absolute;width:0.5rem;height:0.5rem;border-radius:50%;background:#fff;box-shadow:0 0 .6rem #fff;transform:translate(-50%, -50%) scale(1);transform-origin:center center;-webkit-animation:svelte-1kuu68s-PanoSpatialTagPlugin__tag-origin 1.2s forwards;animation:svelte-1kuu68s-PanoSpatialTagPlugin__tag-origin 1.2s forwards;pointer-events:auto}.PanoSpatialTagPlugin__tag-origin.svelte-1kuu68s:after{content:'';position:absolute;top:50%;height:50%;width:2rem;height:2rem;transform:translate(-50%, -50%)}.PanoSpatialTagPlugin__tag-origin-destroy.svelte-1kuu68s{transform:translate(-50%, -50%) scale(0.6);-webkit-animation:svelte-1kuu68s-PanoSpatialTagPlugin__tag-origin-destroy 1.2s forwards .7s;animation:svelte-1kuu68s-PanoSpatialTagPlugin__tag-origin-destroy 1.2s forwards .7s}@-webkit-keyframes svelte-1kuu68s-PanoSpatialTagPlugin__tag-origin{0%{transform:translate(-50%, -50%) scale(1);opacity:0}100%{transform:translate(-50%, -50%) scale(0.6);opacity:1 }}@keyframes svelte-1kuu68s-PanoSpatialTagPlugin__tag-origin{0%{transform:translate(-50%, -50%) scale(1);opacity:0}100%{transform:translate(-50%, -50%) scale(0.6);opacity:1 }}@-webkit-keyframes svelte-1kuu68s-PanoSpatialTagPlugin__tag-origin-destroy{0%{transform:translate(-50%, -50%) scale(0.6);opacity:1}10%{transform:translate(-50%, -50%) scale(1);opacity:0.9}100%{transform:translate(-50%, -50%) scale(1);opacity:0}}@keyframes svelte-1kuu68s-PanoSpatialTagPlugin__tag-origin-destroy{0%{transform:translate(-50%, -50%) scale(0.6);opacity:1}10%{transform:translate(-50%, -50%) scale(1);opacity:0.9}100%{transform:translate(-50%, -50%) scale(1);opacity:0}}");
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function get_each_context(ctx, list, i) {
|
|
@@ -43,7 +43,7 @@ function create_each_block(ctx) {
|
|
|
43
43
|
return {
|
|
44
44
|
c() {
|
|
45
45
|
i = element("i");
|
|
46
|
-
attr(i, "class", "svelte-
|
|
46
|
+
attr(i, "class", "svelte-1kuu68s");
|
|
47
47
|
toggle_class(i, "PanoSpatialTagPlugin__tag-origin", true);
|
|
48
48
|
toggle_class(i, "PanoSpatialTagPlugin__tag-origin-destroy", /*origin*/ ctx[3].destroying);
|
|
49
49
|
set_style(i, "top", style_top, false);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script>import { currentTarget } from '../store';
|
|
2
|
+
export let origins;
|
|
3
|
+
const handleClick = (id) => {
|
|
4
|
+
currentTarget.update(() => `${id}-PanoSpatialTagPlugin-${Date.now()}`);
|
|
5
|
+
};
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
{#each origins as origin}
|
|
9
|
+
<i
|
|
10
|
+
class:PanoSpatialTagPlugin__tag-origin={true}
|
|
11
|
+
class:PanoSpatialTagPlugin__tag-origin-destroy={origin.destroying}
|
|
12
|
+
style:top="{origin.top}%"
|
|
13
|
+
style:left="{origin.left}%"
|
|
14
|
+
style:visibility="{origin.front ? 'visible' : 'hidden'}"
|
|
15
|
+
on:click="{() => handleClick(origin.id)}"
|
|
16
|
+
/>
|
|
17
|
+
{/each}
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
.PanoSpatialTagPlugin__tag-origin {
|
|
21
|
+
position: absolute;
|
|
22
|
+
width: 0.5rem;
|
|
23
|
+
height: 0.5rem;
|
|
24
|
+
border-radius: 50%;
|
|
25
|
+
background: #fff;
|
|
26
|
+
box-shadow: 0 0 .6rem #fff;
|
|
27
|
+
transform: translate(-50%, -50%) scale(1);
|
|
28
|
+
transform-origin: center center;
|
|
29
|
+
animation: PanoSpatialTagPlugin__tag-origin 1.2s forwards;
|
|
30
|
+
pointer-events: auto;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.PanoSpatialTagPlugin__tag-origin:after {
|
|
34
|
+
content: '';
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: 50%;
|
|
37
|
+
height: 50%;
|
|
38
|
+
width: 2rem;
|
|
39
|
+
height: 2rem;
|
|
40
|
+
transform: translate(-50%, -50%);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.PanoSpatialTagPlugin__tag-origin-destroy {
|
|
44
|
+
transform: translate(-50%, -50%) scale(0.6);
|
|
45
|
+
animation: PanoSpatialTagPlugin__tag-origin-destroy 1.2s forwards .7s;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@keyframes PanoSpatialTagPlugin__tag-origin {
|
|
49
|
+
0% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
|
|
50
|
+
100% { transform: translate(-50%, -50%) scale(0.6); opacity: 1 }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@keyframes PanoSpatialTagPlugin__tag-origin-destroy {
|
|
54
|
+
0% { transform: translate(-50%, -50%) scale(0.6); opacity: 1; }
|
|
55
|
+
10% { transform: translate(-50%, -50%) scale(1); opacity: 0.9; }
|
|
56
|
+
100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
|
|
57
|
+
}
|
|
58
|
+
</style>
|