@realsee/dnalogel 2.0.0-alpha.30-beta → 2.0.0-alpha.31
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 +7 -0
- package/dist/ItemLabelPlugin/index.js +398 -160
- package/dist/ItemLabelPlugin/typings.d.ts +5 -0
- package/dist/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
- package/dist/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
- package/dist/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
- package/dist/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
- package/dist/PanoMeasurePlugin/Controller/BaseController.d.ts +5 -2
- package/dist/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
- package/dist/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -0
- package/dist/PanoMeasurePlugin/Controller/index.d.ts +17 -8
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +3 -0
- package/dist/PanoMeasurePlugin/Modules/Magnifier.d.ts +49 -14
- package/dist/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/index.d.ts +4 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/style.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
- package/dist/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
- package/dist/PanoMeasurePlugin/index.d.ts +8 -5
- package/dist/PanoMeasurePlugin/index.js +1893 -3431
- package/dist/PanoMeasurePlugin/typings/data.d.ts +4 -0
- package/dist/PanoMeasurePlugin/typings/event.type.d.ts +10 -1
- package/dist/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
- package/dist/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -2
- package/dist/floorplan/ModelFloorplanPlugin/index.js +3 -3
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +3 -3
- package/dist/index.es.js +1865 -3186
- package/dist/index.js +1800 -3119
- package/dist/index.umd.js +1803 -3123
- package/dist/shared-utils/index.d.ts +1 -0
- package/dist/shared-utils/math/Interval.d.ts +13 -0
- package/dist/shared-utils/math/Rectangle.d.ts +27 -0
- package/dist/shared-utils/math/index.d.ts +2 -0
- package/docs/assets/search.js +1 -1
- package/docs/classes/Magnifier.html +9 -0
- package/docs/classes/ModelRoomLabelController.html +5 -5
- 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 +2 -2
- package/docs/interfaces/CSS3DRenderPluginExportType.html +3 -3
- package/docs/interfaces/CameraMovementPluginExportType.html +3 -3
- package/docs/interfaces/FloorplanBounding.html +5 -5
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +8 -8
- package/docs/interfaces/FloorplanExtraObject.html +4 -4
- 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 +7 -7
- package/docs/interfaces/FloorplanRoomLabelItem.html +4 -4
- package/docs/interfaces/FloorplanServerBounding.html +5 -5
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerEntrance.html +8 -8
- 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 +8 -8
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +4 -4
- 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 +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 -1
- package/docs/interfaces/OpenParameter.html +3 -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 -1
- package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +1 -1
- package/docs/interfaces/PanoMeasureParameterType.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 -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 +10 -10
- package/docs/modules.html +20 -20
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +242 -79
- package/libs/ItemLabelPlugin/ItemLabelItem.js +112 -58
- package/libs/ItemLabelPlugin/Plugin.js +7 -4
- package/libs/ItemLabelPlugin/typings.d.ts +5 -0
- package/libs/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
- package/libs/ItemLabelPlugin/utils/getLabelTransform.js +3 -0
- package/libs/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
- package/libs/ItemLabelPlugin/utils/getStrokeLength.js +16 -0
- package/libs/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
- package/libs/ItemLabelPlugin/utils/isImpacted.js +13 -0
- package/libs/ItemLabelPlugin/utils/parseData.js +1 -1
- package/libs/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
- package/libs/ItemLabelPlugin/utils/transform2RenderData.js +4 -0
- package/libs/PanoMeasurePlugin/Controller/BaseController.d.ts +5 -2
- package/libs/PanoMeasurePlugin/Controller/BaseController.js +9 -1
- package/libs/PanoMeasurePlugin/Controller/EditController.js +4 -4
- package/libs/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
- package/libs/PanoMeasurePlugin/Controller/MixedController.js +337 -0
- package/libs/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -0
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +14 -3
- package/libs/PanoMeasurePlugin/Controller/index.d.ts +17 -8
- package/libs/PanoMeasurePlugin/Controller/index.js +57 -18
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +11 -14
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +3 -0
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +48 -11
- package/libs/PanoMeasurePlugin/Modules/Magnifier.d.ts +49 -14
- package/libs/PanoMeasurePlugin/Modules/Magnifier.js +185 -60
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +1 -1
- package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.js +98 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/index.d.ts +4 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +24 -7
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.js +80 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/style.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/style.js +10 -1
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.js +64 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.js +265 -0
- package/libs/PanoMeasurePlugin/index.d.ts +8 -5
- package/libs/PanoMeasurePlugin/index.js +2 -0
- package/libs/PanoMeasurePlugin/typings/data.d.ts +4 -0
- package/libs/PanoMeasurePlugin/typings/event.type.d.ts +10 -1
- package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
- package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.js +15 -0
- package/libs/PanoMeasurePlugin/utils/constants.js +7 -7
- package/libs/PanoMeasurePlugin/utils/distanceDom.js +19 -14
- package/libs/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -2
- package/libs/PanoMeasurePlugin/utils/mouseGroup.js +5 -6
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +3 -3
- package/libs/shared-utils/index.d.ts +1 -0
- package/libs/shared-utils/index.js +1 -0
- package/libs/shared-utils/math/Interval.d.ts +13 -0
- package/libs/shared-utils/math/Interval.js +40 -0
- package/libs/shared-utils/math/Rectangle.d.ts +27 -0
- package/libs/shared-utils/math/Rectangle.js +50 -0
- package/libs/shared-utils/math/index.d.ts +2 -0
- package/libs/shared-utils/math/index.js +2 -0
- package/package.json +3 -2
|
@@ -24,12 +24,16 @@ import {
|
|
|
24
24
|
} from "svelte/internal";
|
|
25
25
|
|
|
26
26
|
import { Five } from '@realsee/five';
|
|
27
|
-
import
|
|
27
|
+
import "./typings";
|
|
28
28
|
import { beforeUpdate, onDestroy, onMount } from "svelte";
|
|
29
29
|
import * as THREE from 'three';
|
|
30
30
|
import ItemLabelItem from './ItemLabelItem';
|
|
31
31
|
import "./events.type";
|
|
32
32
|
import debounce from '../shared-utils/debounce';
|
|
33
|
+
import { isImpacted } from "./utils/isImpacted";
|
|
34
|
+
import { getStrokeLength } from "./utils/getStrokeLength";
|
|
35
|
+
import { getLabelTransform } from './utils/getLabelTransform';
|
|
36
|
+
import { transform2RenderData } from "./utils/transform2RenderData";
|
|
33
37
|
|
|
34
38
|
function add_css(target) {
|
|
35
39
|
append_styles(target, "svelte-rmdeb", ".item-labels-container.svelte-rmdeb{width:100%;height:100%;position:relative}");
|
|
@@ -37,57 +41,115 @@ function add_css(target) {
|
|
|
37
41
|
|
|
38
42
|
function get_each_context(ctx, list, i) {
|
|
39
43
|
const child_ctx = ctx.slice();
|
|
40
|
-
child_ctx[
|
|
44
|
+
child_ctx[32] = list[i];
|
|
41
45
|
return child_ctx;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
// (
|
|
45
|
-
function
|
|
46
|
-
let first;
|
|
48
|
+
// (248:2) {#if itemLabelItem.visible}
|
|
49
|
+
function create_if_block(ctx) {
|
|
47
50
|
let itemlabelitem;
|
|
48
51
|
let current;
|
|
49
52
|
|
|
50
53
|
itemlabelitem = new ItemLabelItem({
|
|
51
54
|
props: {
|
|
52
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
53
|
-
hooks: /*hooks*/ ctx[
|
|
54
|
-
anchorEnabled: /*
|
|
55
|
+
itemLabel: /*itemLabelItem*/ ctx[32],
|
|
56
|
+
hooks: /*hooks*/ ctx[0],
|
|
57
|
+
anchorEnabled: /*anchorEnabled*/ ctx[2],
|
|
58
|
+
onIconClick: /*onIconClick*/ ctx[6]
|
|
55
59
|
}
|
|
56
60
|
});
|
|
57
61
|
|
|
62
|
+
return {
|
|
63
|
+
c() {
|
|
64
|
+
create_component(itemlabelitem.$$.fragment);
|
|
65
|
+
},
|
|
66
|
+
m(target, anchor) {
|
|
67
|
+
mount_component(itemlabelitem, target, anchor);
|
|
68
|
+
current = true;
|
|
69
|
+
},
|
|
70
|
+
p(ctx, dirty) {
|
|
71
|
+
const itemlabelitem_changes = {};
|
|
72
|
+
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[32];
|
|
73
|
+
if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
74
|
+
if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
|
|
75
|
+
itemlabelitem.$set(itemlabelitem_changes);
|
|
76
|
+
},
|
|
77
|
+
i(local) {
|
|
78
|
+
if (current) return;
|
|
79
|
+
transition_in(itemlabelitem.$$.fragment, local);
|
|
80
|
+
current = true;
|
|
81
|
+
},
|
|
82
|
+
o(local) {
|
|
83
|
+
transition_out(itemlabelitem.$$.fragment, local);
|
|
84
|
+
current = false;
|
|
85
|
+
},
|
|
86
|
+
d(detaching) {
|
|
87
|
+
destroy_component(itemlabelitem, detaching);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// (247:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
93
|
+
function create_each_block(key_1, ctx) {
|
|
94
|
+
let first;
|
|
95
|
+
let if_block_anchor;
|
|
96
|
+
let current;
|
|
97
|
+
let if_block = /*itemLabelItem*/ ctx[32].visible && create_if_block(ctx);
|
|
98
|
+
|
|
58
99
|
return {
|
|
59
100
|
key: key_1,
|
|
60
101
|
first: null,
|
|
61
102
|
c() {
|
|
62
103
|
first = empty();
|
|
63
|
-
|
|
104
|
+
if (if_block) if_block.c();
|
|
105
|
+
if_block_anchor = empty();
|
|
64
106
|
this.first = first;
|
|
65
107
|
},
|
|
66
108
|
m(target, anchor) {
|
|
67
109
|
insert(target, first, anchor);
|
|
68
|
-
|
|
110
|
+
if (if_block) if_block.m(target, anchor);
|
|
111
|
+
insert(target, if_block_anchor, anchor);
|
|
69
112
|
current = true;
|
|
70
113
|
},
|
|
71
114
|
p(new_ctx, dirty) {
|
|
72
115
|
ctx = new_ctx;
|
|
73
|
-
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
116
|
+
|
|
117
|
+
if (/*itemLabelItem*/ ctx[32].visible) {
|
|
118
|
+
if (if_block) {
|
|
119
|
+
if_block.p(ctx, dirty);
|
|
120
|
+
|
|
121
|
+
if (dirty[0] & /*renderItemLabels*/ 2) {
|
|
122
|
+
transition_in(if_block, 1);
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
if_block = create_if_block(ctx);
|
|
126
|
+
if_block.c();
|
|
127
|
+
transition_in(if_block, 1);
|
|
128
|
+
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
129
|
+
}
|
|
130
|
+
} else if (if_block) {
|
|
131
|
+
group_outros();
|
|
132
|
+
|
|
133
|
+
transition_out(if_block, 1, 1, () => {
|
|
134
|
+
if_block = null;
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
check_outros();
|
|
138
|
+
}
|
|
78
139
|
},
|
|
79
140
|
i(local) {
|
|
80
141
|
if (current) return;
|
|
81
|
-
transition_in(
|
|
142
|
+
transition_in(if_block);
|
|
82
143
|
current = true;
|
|
83
144
|
},
|
|
84
145
|
o(local) {
|
|
85
|
-
transition_out(
|
|
146
|
+
transition_out(if_block);
|
|
86
147
|
current = false;
|
|
87
148
|
},
|
|
88
149
|
d(detaching) {
|
|
89
150
|
if (detaching) detach(first);
|
|
90
|
-
|
|
151
|
+
if (if_block) if_block.d(detaching);
|
|
152
|
+
if (detaching) detach(if_block_anchor);
|
|
91
153
|
}
|
|
92
154
|
};
|
|
93
155
|
}
|
|
@@ -98,8 +160,8 @@ function create_fragment(ctx) {
|
|
|
98
160
|
let each_1_lookup = new Map();
|
|
99
161
|
let div_resize_listener;
|
|
100
162
|
let current;
|
|
101
|
-
let each_value = /*renderItemLabels*/ ctx[
|
|
102
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
163
|
+
let each_value = /*renderItemLabels*/ ctx[1];
|
|
164
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[32].id;
|
|
103
165
|
|
|
104
166
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
105
167
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -116,7 +178,7 @@ function create_fragment(ctx) {
|
|
|
116
178
|
}
|
|
117
179
|
|
|
118
180
|
attr(div, "class", "item-labels-container svelte-rmdeb");
|
|
119
|
-
add_render_callback(() => /*div_elementresize_handler*/ ctx[
|
|
181
|
+
add_render_callback(() => /*div_elementresize_handler*/ ctx[13].call(div));
|
|
120
182
|
set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
|
|
121
183
|
},
|
|
122
184
|
m(target, anchor) {
|
|
@@ -126,18 +188,18 @@ function create_fragment(ctx) {
|
|
|
126
188
|
each_blocks[i].m(div, null);
|
|
127
189
|
}
|
|
128
190
|
|
|
129
|
-
div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[
|
|
191
|
+
div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[13].bind(div));
|
|
130
192
|
current = true;
|
|
131
193
|
},
|
|
132
|
-
p(ctx,
|
|
133
|
-
if (dirty & /*renderItemLabels, hooks,
|
|
134
|
-
each_value = /*renderItemLabels*/ ctx[
|
|
194
|
+
p(ctx, dirty) {
|
|
195
|
+
if (dirty[0] & /*renderItemLabels, hooks, anchorEnabled, onIconClick*/ 71) {
|
|
196
|
+
each_value = /*renderItemLabels*/ ctx[1];
|
|
135
197
|
group_outros();
|
|
136
198
|
each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div, outro_and_destroy_block, create_each_block, null, get_each_context);
|
|
137
199
|
check_outros();
|
|
138
200
|
}
|
|
139
201
|
|
|
140
|
-
if (dirty & /*itemsVisible*/ 32) {
|
|
202
|
+
if (dirty[0] & /*itemsVisible*/ 32) {
|
|
141
203
|
set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
|
|
142
204
|
}
|
|
143
205
|
},
|
|
@@ -180,8 +242,14 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
180
242
|
let { wrapper } = $$props;
|
|
181
243
|
let { hooks } = $$props;
|
|
182
244
|
let { displayStrategyType } = $$props;
|
|
245
|
+
let { maxVisibleDistance } = $$props;
|
|
183
246
|
let curItemLabels = null;
|
|
184
247
|
let renderItemLabels = null;
|
|
248
|
+
|
|
249
|
+
let anchorEnabled = (five === null || five === void 0
|
|
250
|
+
? void 0
|
|
251
|
+
: five.currentMode) === Five.Mode.Panorama;
|
|
252
|
+
|
|
185
253
|
let wrapperSize = { width: 0, height: 0 };
|
|
186
254
|
let containerWidth;
|
|
187
255
|
let containerHeight;
|
|
@@ -197,19 +265,36 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
197
265
|
* 1、当前楼层(假设先不考虑多楼层)
|
|
198
266
|
* 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
|
|
199
267
|
* */
|
|
200
|
-
const
|
|
268
|
+
const judgeImpacted = (five, itemLabel) => {
|
|
201
269
|
// 虚拟 VR 仅有一层,不考虑楼层信息
|
|
202
|
-
const raycaster = new Raycaster();
|
|
203
|
-
|
|
204
270
|
const cameraPosition = five.camera.position.clone();
|
|
271
|
+
|
|
205
272
|
const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
|
|
206
273
|
|
|
207
274
|
// 计算点到相机的位置
|
|
208
275
|
const vectorDistance = modelPosition.distanceTo(cameraPosition);
|
|
209
276
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
277
|
+
// 判断距离,大于最大可见距离直接不可见 TODO 把距离计算和碰撞拆分开
|
|
278
|
+
if (maxVisibleDistance !== undefined && five.state.mode === Five.Mode.Panorama) {
|
|
279
|
+
if (vectorDistance > maxVisibleDistance) {
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return isImpacted(five, modelPosition.clone().sub(cameraPosition).normalize(), cameraPosition, vectorDistance);
|
|
285
|
+
}; // raycaster.set(cameraPosition.clone(), modelPosition.clone().sub(cameraPosition).normalize())
|
|
286
|
+
// const [intersection] = five.model.intersectRaycaster(raycaster)
|
|
287
|
+
// return !(intersection && intersection.distance + 1 < vectorDistance);
|
|
288
|
+
|
|
289
|
+
const judgeInViewport = modelPoint => {
|
|
290
|
+
const { camera, model } = five;
|
|
291
|
+
const { x: offsetXFromCenter, y: offsetYFromCenter, z: offsetZFromCenter } = modelPoint.clone().project(camera);
|
|
292
|
+
const ratioFromLeft = (offsetXFromCenter + 1) / 2;
|
|
293
|
+
const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
|
|
294
|
+
const isFront = Math.abs(offsetZFromCenter) < 1;
|
|
295
|
+
const cssOffset = [ratioFromLeft, ratioFromTop];
|
|
296
|
+
const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
|
|
297
|
+
return Boolean(isInViewport);
|
|
213
298
|
};
|
|
214
299
|
|
|
215
300
|
// cssOffset 获取
|
|
@@ -228,10 +313,6 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
228
313
|
return [xOffset, yOffset];
|
|
229
314
|
};
|
|
230
315
|
|
|
231
|
-
const getLabelTransform = cssOffset => {
|
|
232
|
-
return `translate(${cssOffset[0]}px, ${cssOffset[1]}px)`;
|
|
233
|
-
};
|
|
234
|
-
|
|
235
316
|
// 重叠计算
|
|
236
317
|
const isOverlap = (cssOffset, widthOffset) => {
|
|
237
318
|
if (cssOffsetLists.length === 0) {
|
|
@@ -242,19 +323,6 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
242
323
|
return !!hasOverlapPoint;
|
|
243
324
|
};
|
|
244
325
|
|
|
245
|
-
function getStrokeLength(itemSpaceHeight, type) {
|
|
246
|
-
switch (type) {
|
|
247
|
-
case ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL:
|
|
248
|
-
return Math.ceil(-27.78 * itemSpaceHeight + 85);
|
|
249
|
-
case ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.MIDLLE:
|
|
250
|
-
return Math.ceil(-38.9 * itemSpaceHeight + 130);
|
|
251
|
-
case ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.LARGE:
|
|
252
|
-
return Math.ceil(-44.44 * itemSpaceHeight + 140);
|
|
253
|
-
case ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.EXTRA_LARGE:
|
|
254
|
-
return Math.ceil(-92.59 * itemSpaceHeight + 300);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
326
|
const getFormatedItemLabels = (five, labels) => {
|
|
259
327
|
// 计算位置 & 可见性
|
|
260
328
|
const newLabels = labels.map(label => {
|
|
@@ -263,11 +331,18 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
263
331
|
const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
|
|
264
332
|
|
|
265
333
|
// 是否加入碰撞检测
|
|
266
|
-
|
|
267
|
-
|
|
334
|
+
// 配置加入碰撞检测,则判断碰撞检测
|
|
335
|
+
// 在可见范围内, 仅在 Panorama 模态计算
|
|
336
|
+
const isInViewport = five.currentMode === Five.Mode.Panorama
|
|
337
|
+
? judgeInViewport(new Vector3(label.position[0], label.position[1], label.position[2]))
|
|
268
338
|
: true;
|
|
269
339
|
|
|
270
|
-
|
|
340
|
+
// 碰撞
|
|
341
|
+
const isBlocked = modelOcclusionEnable
|
|
342
|
+
? judgeImpacted(five, label)
|
|
343
|
+
: false;
|
|
344
|
+
|
|
345
|
+
const visible = isInViewport && !isBlocked;
|
|
271
346
|
|
|
272
347
|
// 关掉重叠计算
|
|
273
348
|
// const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth)
|
|
@@ -295,25 +370,23 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
295
370
|
|
|
296
371
|
const onItemLabelUpdate = () => {
|
|
297
372
|
cssOffsetLists = [];
|
|
298
|
-
$$invalidate(
|
|
373
|
+
$$invalidate(1, renderItemLabels = getFormatedItemLabels(five, renderItemLabels));
|
|
299
374
|
};
|
|
300
375
|
|
|
301
|
-
beforeUpdate(() => {
|
|
302
|
-
addDataUpdateListener();
|
|
303
|
-
});
|
|
304
|
-
|
|
305
376
|
const handleCameraUpdateCallback = () => {
|
|
306
377
|
$$invalidate(5, itemsVisible = false);
|
|
307
378
|
handleCameraUpdate();
|
|
308
379
|
};
|
|
309
380
|
|
|
310
|
-
|
|
311
|
-
$$invalidate(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
381
|
+
const onFiveModeChange = mode => {
|
|
382
|
+
$$invalidate(5, itemsVisible = false);
|
|
383
|
+
|
|
384
|
+
five.once('initAnimationEnded', (panoIndex, pose, userAction) => {
|
|
385
|
+
$$invalidate(2, anchorEnabled = mode === Five.Mode.Panorama);
|
|
386
|
+
$$invalidate(5, itemsVisible = true);
|
|
387
|
+
if (!userAction) return; else onItemLabelUpdate();
|
|
388
|
+
});
|
|
389
|
+
};
|
|
317
390
|
|
|
318
391
|
const handleCameraUpdate = debounce(
|
|
319
392
|
() => {
|
|
@@ -334,7 +407,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
334
407
|
|
|
335
408
|
const addDataUpdateListener = () => {
|
|
336
409
|
if (curItemLabels !== itemLabels) {
|
|
337
|
-
$$invalidate(
|
|
410
|
+
$$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
|
|
338
411
|
curItemLabels = itemLabels;
|
|
339
412
|
onItemLabelUpdate();
|
|
340
413
|
}
|
|
@@ -352,8 +425,92 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
352
425
|
}
|
|
353
426
|
});
|
|
354
427
|
|
|
428
|
+
const getNearObserverPano = (fromPositionVector, observers) => {
|
|
429
|
+
let candidates = [];
|
|
430
|
+
|
|
431
|
+
for (let i = 0; i < observers.length; i++) {
|
|
432
|
+
const { position: obVector, panoIndex } = observers[i];
|
|
433
|
+
const distance = fromPositionVector.distanceTo(obVector);
|
|
434
|
+
|
|
435
|
+
if (maxVisibleDistance === undefined || distance <= maxVisibleDistance || five.state.mode !== Five.Mode.Panorama) {
|
|
436
|
+
candidates.push({ panoIndex, obVector, distance });
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
candidates = candidates.sort((a, b) => a.distance - b.distance);
|
|
441
|
+
let observerIndex;
|
|
442
|
+
|
|
443
|
+
for (let i = 0; i < candidates.length; i++) {
|
|
444
|
+
const { obVector, distance, panoIndex } = candidates[i];
|
|
445
|
+
const isImpactedRes = isImpacted(five, fromPositionVector, obVector, distance);
|
|
446
|
+
|
|
447
|
+
if (!isImpactedRes) {
|
|
448
|
+
observerIndex = panoIndex;
|
|
449
|
+
break;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
return typeof observerIndex === "number"
|
|
454
|
+
? observers[observerIndex]
|
|
455
|
+
: undefined;
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
const onIconClick = itemLabel => {
|
|
459
|
+
if (five.state.mode === Five.Mode.Panorama) return;
|
|
460
|
+
const observers = five.work.observers;
|
|
461
|
+
const fromPositionVector = new Vector3(itemLabel.position[0], itemLabel.position[1], itemLabel.position[2]);
|
|
462
|
+
const observer = getNearObserverPano(fromPositionVector, observers);
|
|
463
|
+
|
|
464
|
+
if (observer) {
|
|
465
|
+
console.log('--has observer--');
|
|
466
|
+
itemLabel.observerIndex = observer.panoIndex;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (typeof itemLabel.observerIndex === "number") {
|
|
470
|
+
const observer = observers[itemLabel.observerIndex];
|
|
471
|
+
const direction = fromPositionVector.clone().sub(observer.position).normalize();
|
|
472
|
+
|
|
473
|
+
const cameraCoord = {
|
|
474
|
+
longitude: Math.PI + Math.atan2(direction.x, direction.z),
|
|
475
|
+
latitude: Math.acos(direction.y / direction.length()) - Math.PI / 2
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
five.setState(Object.assign(Object.assign({}, cameraCoord), {
|
|
479
|
+
mode: Five.Mode.Panorama,
|
|
480
|
+
panoIndex: itemLabel.observerIndex
|
|
481
|
+
}));
|
|
482
|
+
|
|
483
|
+
// 游走结束更新 render list
|
|
484
|
+
five.once('initAnimationEnded', () => {
|
|
485
|
+
$$invalidate(1, renderItemLabels = renderItemLabels.map(item => {
|
|
486
|
+
return Object.assign(Object.assign({}, item), { isFold: item.id !== itemLabel.id });
|
|
487
|
+
}));
|
|
488
|
+
|
|
489
|
+
five.once('cameraUpdate', () => {
|
|
490
|
+
$$invalidate(1, renderItemLabels = renderItemLabels.map(item => {
|
|
491
|
+
return Object.assign(Object.assign({}, item), { isFold: false });
|
|
492
|
+
}));
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
beforeUpdate(() => {
|
|
499
|
+
addDataUpdateListener();
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
onMount(() => {
|
|
503
|
+
$$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
|
|
504
|
+
curItemLabels = itemLabels;
|
|
505
|
+
onItemLabelUpdate();
|
|
506
|
+
addResizeListener();
|
|
507
|
+
five.on('cameraUpdate', handleCameraUpdateCallback);
|
|
508
|
+
five.on('modeChange', onFiveModeChange);
|
|
509
|
+
});
|
|
510
|
+
|
|
355
511
|
onDestroy(() => {
|
|
356
512
|
five.off('cameraUpdate', handleCameraUpdateCallback);
|
|
513
|
+
five.off('modeChange', onFiveModeChange);
|
|
357
514
|
resizeObserver.unobserve(wrapper);
|
|
358
515
|
});
|
|
359
516
|
|
|
@@ -365,25 +522,29 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
365
522
|
}
|
|
366
523
|
|
|
367
524
|
$$self.$$set = $$props => {
|
|
368
|
-
if ('five' in $$props) $$invalidate(
|
|
369
|
-
if ('modelOcclusionEnable' in $$props) $$invalidate(
|
|
370
|
-
if ('itemLabels' in $$props) $$invalidate(
|
|
371
|
-
if ('wrapper' in $$props) $$invalidate(
|
|
372
|
-
if ('hooks' in $$props) $$invalidate(
|
|
373
|
-
if ('displayStrategyType' in $$props) $$invalidate(
|
|
525
|
+
if ('five' in $$props) $$invalidate(7, five = $$props.five);
|
|
526
|
+
if ('modelOcclusionEnable' in $$props) $$invalidate(8, modelOcclusionEnable = $$props.modelOcclusionEnable);
|
|
527
|
+
if ('itemLabels' in $$props) $$invalidate(9, itemLabels = $$props.itemLabels);
|
|
528
|
+
if ('wrapper' in $$props) $$invalidate(10, wrapper = $$props.wrapper);
|
|
529
|
+
if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
|
|
530
|
+
if ('displayStrategyType' in $$props) $$invalidate(11, displayStrategyType = $$props.displayStrategyType);
|
|
531
|
+
if ('maxVisibleDistance' in $$props) $$invalidate(12, maxVisibleDistance = $$props.maxVisibleDistance);
|
|
374
532
|
};
|
|
375
533
|
|
|
376
534
|
return [
|
|
377
|
-
five,
|
|
378
535
|
hooks,
|
|
379
536
|
renderItemLabels,
|
|
537
|
+
anchorEnabled,
|
|
380
538
|
containerWidth,
|
|
381
539
|
containerHeight,
|
|
382
540
|
itemsVisible,
|
|
541
|
+
onIconClick,
|
|
542
|
+
five,
|
|
383
543
|
modelOcclusionEnable,
|
|
384
544
|
itemLabels,
|
|
385
545
|
wrapper,
|
|
386
546
|
displayStrategyType,
|
|
547
|
+
maxVisibleDistance,
|
|
387
548
|
div_elementresize_handler
|
|
388
549
|
];
|
|
389
550
|
}
|
|
@@ -399,14 +560,16 @@ class Component extends SvelteComponent {
|
|
|
399
560
|
create_fragment,
|
|
400
561
|
safe_not_equal,
|
|
401
562
|
{
|
|
402
|
-
five:
|
|
403
|
-
modelOcclusionEnable:
|
|
404
|
-
itemLabels:
|
|
405
|
-
wrapper:
|
|
406
|
-
hooks:
|
|
407
|
-
displayStrategyType:
|
|
563
|
+
five: 7,
|
|
564
|
+
modelOcclusionEnable: 8,
|
|
565
|
+
itemLabels: 9,
|
|
566
|
+
wrapper: 10,
|
|
567
|
+
hooks: 0,
|
|
568
|
+
displayStrategyType: 11,
|
|
569
|
+
maxVisibleDistance: 12
|
|
408
570
|
},
|
|
409
|
-
add_css
|
|
571
|
+
add_css,
|
|
572
|
+
[-1, -1]
|
|
410
573
|
);
|
|
411
574
|
}
|
|
412
575
|
}
|