@realsee/dnalogel 2.0.0-alpha.10 → 2.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CSS3DRenderPlugin/index.js +17 -14
- package/dist/CameraMovementPlugin/index.js +40 -15
- package/dist/ModelChassisCompassPlugin/index.js +32 -6
- package/dist/ModelEntryDoorGuidePlugin/index.js +48 -18
- package/dist/ModelItemLabelPlugin/events.type.d.ts +9 -0
- package/dist/ModelItemLabelPlugin/index.d.ts +4 -0
- package/dist/ModelItemLabelPlugin/index.js +679 -0
- package/dist/ModelItemLabelPlugin/typings.d.ts +55 -0
- package/dist/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/dist/ModelRoomLabelPlugin/index.js +71 -28
- package/dist/PanoCompassPlugin/index.js +311 -164
- package/dist/PanoCursorRaycasterPlugin/index.js +5 -3
- package/dist/PanoMeasurePlugin/index.js +1337 -583
- package/dist/PanoRulerPlugin/index.js +32 -5
- package/dist/PanoSpatialTagPlugin/index.js +73 -38
- package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +1 -0
- package/dist/floorplan/ModelFloorplanPlugin/index.js +678 -439
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
- package/dist/floorplan/TopviewFloorplanPlugin/Controller.d.ts +1 -0
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +403 -230
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +3596 -1612
- package/dist/index.js +3602 -1616
- package/dist/index.umd.js +3605 -1620
- package/docs/assets/main.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/ModelRoomLabelController.html +6 -6
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ModelFloorplanErrorType.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/LineJson.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
- package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
- package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
- package/docs/modules.html +12 -12
- package/libs/CSS3DRenderPlugin/index.js +16 -13
- package/libs/CameraMovementPlugin/index.js +24 -15
- package/libs/ModelChassisCompassPlugin/index.js +14 -5
- package/libs/ModelEntryDoorGuidePlugin/index.js +24 -12
- package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +422 -0
- package/libs/ModelItemLabelPlugin/ItemLabelItem.js +133 -0
- package/libs/ModelItemLabelPlugin/events.type.d.ts +9 -0
- package/libs/ModelItemLabelPlugin/events.type.js +1 -0
- package/libs/ModelItemLabelPlugin/index.d.ts +4 -0
- package/libs/ModelItemLabelPlugin/index.js +172 -0
- package/libs/ModelItemLabelPlugin/typings.d.ts +55 -0
- package/libs/ModelItemLabelPlugin/typings.js +6 -0
- package/libs/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
- package/libs/ModelItemLabelPlugin/utils/parseData.js +4 -0
- package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
- package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +7 -5
- package/libs/PanoCompassPlugin/index.js +225 -128
- package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
- package/libs/PanoMeasurePlugin/Controller/BaseController.js +68 -13
- package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
- package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +234 -152
- package/libs/PanoMeasurePlugin/Controller/index.js +131 -47
- package/libs/PanoMeasurePlugin/Model/index.js +30 -5
- package/libs/PanoMeasurePlugin/Model/line.js +60 -10
- package/libs/PanoMeasurePlugin/Model/point.js +24 -4
- package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +59 -14
- package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
- package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
- package/libs/PanoMeasurePlugin/Modules/Magnifier.js +60 -10
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +83 -37
- package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +61 -30
- package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -2
- package/libs/PanoMeasurePlugin/utils/line.js +8 -7
- package/libs/PanoRulerPlugin/index.js +16 -5
- package/libs/PanoSpatialTagPlugin/Components/tag.js +9 -9
- package/libs/PanoSpatialTagPlugin/index.js +11 -9
- package/libs/floorplan/Components/BaseImage.js +10 -5
- package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -1
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +5 -6
- package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +24 -11
- package/libs/floorplan/ModelFloorplanPlugin/Components/Main.js +77 -69
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
- package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +1 -0
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +457 -273
- package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +33 -22
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +3 -1
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +97 -36
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.d.ts +1 -0
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +232 -108
- package/libs/floorplan/utils/formatData.js +43 -28
- package/libs/floorplan/utils/formatPosition.js +1 -1
- package/libs/index.d.ts +1 -0
- package/libs/index.js +2 -0
- package/libs/shared-utils/Subscribe.js +8 -1
- package/libs/shared-utils/animationFrame/BetterTween.js +47 -18
- package/libs/shared-utils/createCanvasTextTexture.js +6 -5
- package/libs/shared-utils/five/changeMode.js +23 -12
- package/libs/shared-utils/getPxmm.js +1 -1
- package/libs/shared-utils/math/evenNumber.js +1 -1
- package/libs/shared-utils/three/loadFbxObj.js +20 -9
- package/libs/shared-utils/three/loadTexture.js +17 -6
- package/libs/shared-utils/three/transfromToMeshBasicMaterial.js +2 -1
- package/libs/shared-utils/tinyEJSrender.js +36 -6
- package/libs/shared-utils/to.js +21 -10
- package/libs/shared-utils/useDebounce.js +1 -1
- package/libs/shared-utils/useThrottle.js +2 -1
- package/package.json +2 -2
- package/CHANGELOG.md +0 -34
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var five = require('@realsee/five');
|
|
6
|
+
var internal = require('svelte/internal');
|
|
7
|
+
var svelte = require('svelte');
|
|
8
|
+
var THREE = require('three');
|
|
9
|
+
var classNames = require('classnames');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
function _interopNamespace(e) {
|
|
14
|
+
if (e && e.__esModule) return e;
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n["default"] = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
|
|
32
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
33
|
+
|
|
34
|
+
var DISPLAY_STRATEGY_TYPE;
|
|
35
|
+
(function (DISPLAY_STRATEGY_TYPE) {
|
|
36
|
+
DISPLAY_STRATEGY_TYPE["SMALL"] = "small";
|
|
37
|
+
DISPLAY_STRATEGY_TYPE["MIDLLE"] = "middle";
|
|
38
|
+
DISPLAY_STRATEGY_TYPE["LARGE"] = "large";
|
|
39
|
+
})(DISPLAY_STRATEGY_TYPE || (DISPLAY_STRATEGY_TYPE = {}));
|
|
40
|
+
|
|
41
|
+
/* src/ModelItemLabelPlugin/ItemLabelItem.svelte generated by Svelte v3.47.0 */
|
|
42
|
+
|
|
43
|
+
function add_css$1(target) {
|
|
44
|
+
internal.append_styles(target, "svelte-1mttyji", ".item-label-item.svelte-1mttyji{position:absolute;z-index:0;transform:none;cursor:pointer;pointer-events:none;user-select:none;opacity:0}.item-label-item.visible.svelte-1mttyji{opacity:1;animation:svelte-1mttyji-fadeIn .3s ease-in}.item-label-item__text-wrap.svelte-1mttyji::before{content:'';position:absolute;width:100%;height:100%;background-color:rgba(0, 0, 0, .3);filter:blur(16px);z-index:-1}.item-label-item__text-wrap.svelte-1mttyji{padding:6px 6px 0;position:absolute;height:20px;pointer-events:all;background-size:100% 100%;background-repeat:no-repeat;white-space:nowrap;line-height:10px;font-size:11px;font-weight:bold;color:#FFEAC0;transform:translate(-50%, 0);display:flex;justify-content:center;align-items:center}.item-label-item__text.svelte-1mttyji{padding-bottom:4px;border-top:0 solid;border-left:0 solid;border-right:0 solid;border-bottom:1px solid;border-image:linear-gradient(to right, rgba(234, 208, 154, 0), rgba(234, 208, 154, 100), rgba(234, 208, 154, 0)) 4.5 1 4.5}.item-label-item__bar.svelte-1mttyji{position:absolute;bottom:0;width:1px;background-image:linear-gradient(to bottom, rgba(234, 208, 154, 0), rgba(234, 208, 154, 1))}@keyframes svelte-1mttyji-fadeIn{from{opacity:0\n }to{opacity:1\n }}");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function create_fragment$1(ctx) {
|
|
48
|
+
let div2;
|
|
49
|
+
let div0;
|
|
50
|
+
let span;
|
|
51
|
+
|
|
52
|
+
let t0_value = (/*itemLabel*/ ctx[0].name.length > 6
|
|
53
|
+
? `${/*itemLabel*/ ctx[0].name.slice(0, 6)}...`
|
|
54
|
+
: /*itemLabel*/ ctx[0].name) + "";
|
|
55
|
+
|
|
56
|
+
let t0;
|
|
57
|
+
let t1;
|
|
58
|
+
let div1;
|
|
59
|
+
let div2_class_value;
|
|
60
|
+
let mounted;
|
|
61
|
+
let dispose;
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
c() {
|
|
65
|
+
div2 = internal.element("div");
|
|
66
|
+
div0 = internal.element("div");
|
|
67
|
+
span = internal.element("span");
|
|
68
|
+
t0 = internal.text(t0_value);
|
|
69
|
+
t1 = internal.space();
|
|
70
|
+
div1 = internal.element("div");
|
|
71
|
+
internal.attr(span, "class", "item-label-item__text svelte-1mttyji");
|
|
72
|
+
internal.attr(div0, "class", "item-label-item__text-wrap svelte-1mttyji");
|
|
73
|
+
internal.set_style(div0, "top", `-${/*itemLabel*/ ctx[0].strokeLength + 26}px`);
|
|
74
|
+
internal.attr(div1, "class", "item-label-item__bar svelte-1mttyji");
|
|
75
|
+
internal.set_style(div1, "height", `${/*itemLabel*/ ctx[0].strokeLength}px`);
|
|
76
|
+
internal.attr(div2, "class", div2_class_value = "" + (internal.null_to_empty(classNames__default["default"]("item-label-item", { visible: /*itemLabel*/ ctx[0].visible })) + " svelte-1mttyji"));
|
|
77
|
+
internal.set_style(div2, "z-index", /*itemLabel*/ ctx[0].zIndex, false);
|
|
78
|
+
internal.set_style(div2, "transform", /*itemLabel*/ ctx[0].transform, false);
|
|
79
|
+
},
|
|
80
|
+
m(target, anchor) {
|
|
81
|
+
internal.insert(target, div2, anchor);
|
|
82
|
+
internal.append(div2, div0);
|
|
83
|
+
internal.append(div0, span);
|
|
84
|
+
internal.append(span, t0);
|
|
85
|
+
internal.append(div2, t1);
|
|
86
|
+
internal.append(div2, div1);
|
|
87
|
+
|
|
88
|
+
if (!mounted) {
|
|
89
|
+
dispose = internal.listen(span, "click", /*onClick*/ ctx[1]);
|
|
90
|
+
mounted = true;
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
p(ctx, [dirty]) {
|
|
94
|
+
if (dirty & /*itemLabel*/ 1 && t0_value !== (t0_value = (/*itemLabel*/ ctx[0].name.length > 6
|
|
95
|
+
? `${/*itemLabel*/ ctx[0].name.slice(0, 6)}...`
|
|
96
|
+
: /*itemLabel*/ ctx[0].name) + "")) internal.set_data(t0, t0_value);
|
|
97
|
+
|
|
98
|
+
if (dirty & /*itemLabel*/ 1) {
|
|
99
|
+
internal.set_style(div0, "top", `-${/*itemLabel*/ ctx[0].strokeLength + 26}px`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (dirty & /*itemLabel*/ 1) {
|
|
103
|
+
internal.set_style(div1, "height", `${/*itemLabel*/ ctx[0].strokeLength}px`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (dirty & /*itemLabel*/ 1 && div2_class_value !== (div2_class_value = "" + (internal.null_to_empty(classNames__default["default"]("item-label-item", { visible: /*itemLabel*/ ctx[0].visible })) + " svelte-1mttyji"))) {
|
|
107
|
+
internal.attr(div2, "class", div2_class_value);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (dirty & /*itemLabel*/ 1) {
|
|
111
|
+
internal.set_style(div2, "z-index", /*itemLabel*/ ctx[0].zIndex, false);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (dirty & /*itemLabel*/ 1) {
|
|
115
|
+
internal.set_style(div2, "transform", /*itemLabel*/ ctx[0].transform, false);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
i: internal.noop,
|
|
119
|
+
o: internal.noop,
|
|
120
|
+
d(detaching) {
|
|
121
|
+
if (detaching) internal.detach(div2);
|
|
122
|
+
mounted = false;
|
|
123
|
+
dispose();
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function instance$1($$self, $$props, $$invalidate) {
|
|
129
|
+
let { itemLabel } = $$props;
|
|
130
|
+
let { hooks } = $$props;
|
|
131
|
+
|
|
132
|
+
function onClick() {
|
|
133
|
+
console.log('__onclick___: ', itemLabel);
|
|
134
|
+
hooks.emit('onLabelClick', itemLabel);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
$$self.$$set = $$props => {
|
|
138
|
+
if ('itemLabel' in $$props) $$invalidate(0, itemLabel = $$props.itemLabel);
|
|
139
|
+
if ('hooks' in $$props) $$invalidate(2, hooks = $$props.hooks);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
return [itemLabel, onClick, hooks];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
class ItemLabelItem extends internal.SvelteComponent {
|
|
146
|
+
constructor(options) {
|
|
147
|
+
super();
|
|
148
|
+
internal.init(this, options, instance$1, create_fragment$1, internal.safe_not_equal, { itemLabel: 0, hooks: 2 }, add_css$1);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* src/ModelItemLabelPlugin/ItemLabelComponent.svelte generated by Svelte v3.47.0 */
|
|
153
|
+
|
|
154
|
+
function add_css(target) {
|
|
155
|
+
internal.append_styles(target, "svelte-rmdeb", ".item-labels-container.svelte-rmdeb{width:100%;height:100%;position:relative}");
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function get_each_context(ctx, list, i) {
|
|
159
|
+
const child_ctx = ctx.slice();
|
|
160
|
+
child_ctx[26] = list[i];
|
|
161
|
+
return child_ctx;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// (179:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
165
|
+
function create_each_block(key_1, ctx) {
|
|
166
|
+
let first;
|
|
167
|
+
let itemlabelitem;
|
|
168
|
+
let current;
|
|
169
|
+
|
|
170
|
+
itemlabelitem = new ItemLabelItem({
|
|
171
|
+
props: {
|
|
172
|
+
itemLabel: /*itemLabelItem*/ ctx[26],
|
|
173
|
+
hooks: /*hooks*/ ctx[0]
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
return {
|
|
178
|
+
key: key_1,
|
|
179
|
+
first: null,
|
|
180
|
+
c() {
|
|
181
|
+
first = internal.empty();
|
|
182
|
+
internal.create_component(itemlabelitem.$$.fragment);
|
|
183
|
+
this.first = first;
|
|
184
|
+
},
|
|
185
|
+
m(target, anchor) {
|
|
186
|
+
internal.insert(target, first, anchor);
|
|
187
|
+
internal.mount_component(itemlabelitem, target, anchor);
|
|
188
|
+
current = true;
|
|
189
|
+
},
|
|
190
|
+
p(new_ctx, dirty) {
|
|
191
|
+
ctx = new_ctx;
|
|
192
|
+
const itemlabelitem_changes = {};
|
|
193
|
+
if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[26];
|
|
194
|
+
if (dirty & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
195
|
+
itemlabelitem.$set(itemlabelitem_changes);
|
|
196
|
+
},
|
|
197
|
+
i(local) {
|
|
198
|
+
if (current) return;
|
|
199
|
+
internal.transition_in(itemlabelitem.$$.fragment, local);
|
|
200
|
+
current = true;
|
|
201
|
+
},
|
|
202
|
+
o(local) {
|
|
203
|
+
internal.transition_out(itemlabelitem.$$.fragment, local);
|
|
204
|
+
current = false;
|
|
205
|
+
},
|
|
206
|
+
d(detaching) {
|
|
207
|
+
if (detaching) internal.detach(first);
|
|
208
|
+
internal.destroy_component(itemlabelitem, detaching);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function create_fragment(ctx) {
|
|
214
|
+
let div;
|
|
215
|
+
let each_blocks = [];
|
|
216
|
+
let each_1_lookup = new Map();
|
|
217
|
+
let div_resize_listener;
|
|
218
|
+
let current;
|
|
219
|
+
let each_value = /*renderItemLabels*/ ctx[1];
|
|
220
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[26].id;
|
|
221
|
+
|
|
222
|
+
for (let i = 0; i < each_value.length; i += 1) {
|
|
223
|
+
let child_ctx = get_each_context(ctx, each_value, i);
|
|
224
|
+
let key = get_key(child_ctx);
|
|
225
|
+
each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return {
|
|
229
|
+
c() {
|
|
230
|
+
div = internal.element("div");
|
|
231
|
+
|
|
232
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
233
|
+
each_blocks[i].c();
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
internal.attr(div, "class", "item-labels-container svelte-rmdeb");
|
|
237
|
+
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[9].call(div));
|
|
238
|
+
},
|
|
239
|
+
m(target, anchor) {
|
|
240
|
+
internal.insert(target, div, anchor);
|
|
241
|
+
|
|
242
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
243
|
+
each_blocks[i].m(div, null);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[9].bind(div));
|
|
247
|
+
current = true;
|
|
248
|
+
},
|
|
249
|
+
p(ctx, [dirty]) {
|
|
250
|
+
if (dirty & /*renderItemLabels, hooks*/ 3) {
|
|
251
|
+
each_value = /*renderItemLabels*/ ctx[1];
|
|
252
|
+
internal.group_outros();
|
|
253
|
+
each_blocks = internal.update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div, internal.outro_and_destroy_block, create_each_block, null, get_each_context);
|
|
254
|
+
internal.check_outros();
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
i(local) {
|
|
258
|
+
if (current) return;
|
|
259
|
+
|
|
260
|
+
for (let i = 0; i < each_value.length; i += 1) {
|
|
261
|
+
internal.transition_in(each_blocks[i]);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
current = true;
|
|
265
|
+
},
|
|
266
|
+
o(local) {
|
|
267
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
268
|
+
internal.transition_out(each_blocks[i]);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
current = false;
|
|
272
|
+
},
|
|
273
|
+
d(detaching) {
|
|
274
|
+
if (detaching) internal.detach(div);
|
|
275
|
+
|
|
276
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
277
|
+
each_blocks[i].d();
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
div_resize_listener();
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
let cssHeight = 26;
|
|
286
|
+
let basicWidth = 11;
|
|
287
|
+
|
|
288
|
+
function instance($$self, $$props, $$invalidate) {
|
|
289
|
+
const { Raycaster, Vector3 } = THREE__namespace;
|
|
290
|
+
let { five } = $$props;
|
|
291
|
+
let { modelOcclusionEnable } = $$props;
|
|
292
|
+
let { itemLabels } = $$props;
|
|
293
|
+
let { wrapper } = $$props;
|
|
294
|
+
let { hooks } = $$props;
|
|
295
|
+
let { displayStrategyType } = $$props;
|
|
296
|
+
let curItemLabels = null;
|
|
297
|
+
let renderItemLabels = null;
|
|
298
|
+
let wrapperSize = { width: 0, height: 0 };
|
|
299
|
+
let containerWidth;
|
|
300
|
+
let containerHeight;
|
|
301
|
+
|
|
302
|
+
// 计算重叠
|
|
303
|
+
let cssOffsetLists = [];
|
|
304
|
+
|
|
305
|
+
const getLabelVisible = (five, itemLabel) => {
|
|
306
|
+
// 虚拟 VR 仅有一层,不考虑楼层信息
|
|
307
|
+
const raycaster = new Raycaster();
|
|
308
|
+
|
|
309
|
+
const cameraPosition = five.camera.position.clone();
|
|
310
|
+
const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
|
|
311
|
+
|
|
312
|
+
// 计算点到相机的位置
|
|
313
|
+
const vectorDistance = modelPosition.distanceTo(cameraPosition);
|
|
314
|
+
|
|
315
|
+
raycaster.set(cameraPosition.clone(), modelPosition.clone().sub(cameraPosition).normalize());
|
|
316
|
+
const [intersection] = five.model.intersectRaycaster(raycaster);
|
|
317
|
+
return !(intersection && intersection.distance + 1 < vectorDistance);
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
// cssOffset 获取
|
|
321
|
+
const getLabelCssOffset = (five, itemLabel) => {
|
|
322
|
+
const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
|
|
323
|
+
const cssPosition = five.project2d(modelPosition);
|
|
324
|
+
|
|
325
|
+
const xOffset = cssPosition === null || cssPosition === void 0
|
|
326
|
+
? void 0
|
|
327
|
+
: cssPosition.x;
|
|
328
|
+
|
|
329
|
+
const yOffset = cssPosition === null || cssPosition === void 0
|
|
330
|
+
? void 0
|
|
331
|
+
: cssPosition.y;
|
|
332
|
+
|
|
333
|
+
return [xOffset, yOffset];
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const getLabelTransform = cssOffset => {
|
|
337
|
+
return `translate(${cssOffset[0]}px, ${cssOffset[1]}px)`;
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
// 重叠计算
|
|
341
|
+
const isOverlap = (cssOffset, widthOffset) => {
|
|
342
|
+
if (cssOffsetLists.length === 0) {
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const hasOverlapPoint = cssOffsetLists.find(item => cssOffset[0] >= item[0] - widthOffset && cssOffset[0] <= item[0] + widthOffset || cssOffset[1] >= item[1] - cssHeight && cssOffset[1] <= item[1] + cssHeight);
|
|
347
|
+
return !!hasOverlapPoint;
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
function getStrokeLength(itemSpaceHeight, type) {
|
|
351
|
+
switch (type) {
|
|
352
|
+
case DISPLAY_STRATEGY_TYPE.SMALL:
|
|
353
|
+
return Math.ceil(-27.78 * itemSpaceHeight + 85);
|
|
354
|
+
case DISPLAY_STRATEGY_TYPE.MIDLLE:
|
|
355
|
+
return Math.ceil(-38.9 * itemSpaceHeight + 130);
|
|
356
|
+
case DISPLAY_STRATEGY_TYPE.LARGE:
|
|
357
|
+
return Math.ceil(-44.44 * itemSpaceHeight + 140);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const getFormatedItemLabels = (five, labels) => {
|
|
362
|
+
// 计算位置 & 可见性
|
|
363
|
+
const newLabels = labels.map(label => {
|
|
364
|
+
const cssOffset = getLabelCssOffset(five, label);
|
|
365
|
+
const curLabelWidth = label.name.length * basicWidth;
|
|
366
|
+
const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
|
|
367
|
+
|
|
368
|
+
// 是否加入碰撞检测
|
|
369
|
+
const naturalVisible = modelOcclusionEnable
|
|
370
|
+
? getLabelVisible(five, label)
|
|
371
|
+
: true;
|
|
372
|
+
|
|
373
|
+
const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth);
|
|
374
|
+
if (!visible) return Object.assign(Object.assign({}, label), { visible });
|
|
375
|
+
cssOffsetLists.push(cssOffset);
|
|
376
|
+
|
|
377
|
+
// position
|
|
378
|
+
const transform = getLabelTransform(cssOffset);
|
|
379
|
+
|
|
380
|
+
return Object.assign(Object.assign({}, label), { visible, transform, strokeLength });
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
const sortedItemLabelItems = newLabels.filter(({ visible }) => visible).map(label => ({
|
|
384
|
+
itemLabelItem: label,
|
|
385
|
+
distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five.camera.position)
|
|
386
|
+
})).sort((a, b) => a.distance - b.distance);
|
|
387
|
+
|
|
388
|
+
return newLabels.map(label => {
|
|
389
|
+
const sortIndex = sortedItemLabelItems.findIndex(item => item.itemLabelItem.id === label.id);
|
|
390
|
+
if (sortIndex !== undefined) return Object.assign(Object.assign({}, label), { zIndex: sortIndex * 10 });
|
|
391
|
+
return label;
|
|
392
|
+
});
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
const onItemLabelUpdate = () => {
|
|
396
|
+
cssOffsetLists = [];
|
|
397
|
+
$$invalidate(1, renderItemLabels = getFormatedItemLabels(five, renderItemLabels));
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
svelte.beforeUpdate(() => {
|
|
401
|
+
addDataUpdateListener();
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
svelte.onMount(() => {
|
|
405
|
+
$$invalidate(1, renderItemLabels = itemLabels);
|
|
406
|
+
curItemLabels = itemLabels;
|
|
407
|
+
onItemLabelUpdate();
|
|
408
|
+
|
|
409
|
+
// five.on('cameraUpdate', onItemLabelUpdate)
|
|
410
|
+
addResizeListener();
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
const addResizeListener = () => {
|
|
414
|
+
wrapperSize = {
|
|
415
|
+
width: wrapper.clientWidth,
|
|
416
|
+
height: wrapper.clientHeight
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
resizeObserver.observe(wrapper);
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
const addDataUpdateListener = () => {
|
|
423
|
+
if (curItemLabels !== itemLabels) {
|
|
424
|
+
$$invalidate(1, renderItemLabels = itemLabels);
|
|
425
|
+
curItemLabels = itemLabels;
|
|
426
|
+
console.log('--debug--update--');
|
|
427
|
+
onItemLabelUpdate();
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
432
|
+
const entry = entries[0];
|
|
433
|
+
const target = entry.target;
|
|
434
|
+
const curWidth = target.clientWidth;
|
|
435
|
+
const curHeight = target.clientHeight;
|
|
436
|
+
|
|
437
|
+
if (wrapperSize.width !== curWidth || wrapperSize.height !== curHeight) {
|
|
438
|
+
wrapperSize = { width: curWidth, height: curHeight };
|
|
439
|
+
onItemLabelUpdate();
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
svelte.onDestroy(() => {
|
|
444
|
+
// five.off('cameraUpdate', onItemLabelUpdate)
|
|
445
|
+
resizeObserver.unobserve(wrapper);
|
|
446
|
+
|
|
447
|
+
curItemLabels = null;
|
|
448
|
+
$$invalidate(1, renderItemLabels = null);
|
|
449
|
+
wrapperSize = { width: 0, height: 0 };
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
function div_elementresize_handler() {
|
|
453
|
+
containerWidth = this.clientWidth;
|
|
454
|
+
containerHeight = this.clientHeight;
|
|
455
|
+
$$invalidate(2, containerWidth);
|
|
456
|
+
$$invalidate(3, containerHeight);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
$$self.$$set = $$props => {
|
|
460
|
+
if ('five' in $$props) $$invalidate(4, five = $$props.five);
|
|
461
|
+
if ('modelOcclusionEnable' in $$props) $$invalidate(5, modelOcclusionEnable = $$props.modelOcclusionEnable);
|
|
462
|
+
if ('itemLabels' in $$props) $$invalidate(6, itemLabels = $$props.itemLabels);
|
|
463
|
+
if ('wrapper' in $$props) $$invalidate(7, wrapper = $$props.wrapper);
|
|
464
|
+
if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
|
|
465
|
+
if ('displayStrategyType' in $$props) $$invalidate(8, displayStrategyType = $$props.displayStrategyType);
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
return [
|
|
469
|
+
hooks,
|
|
470
|
+
renderItemLabels,
|
|
471
|
+
containerWidth,
|
|
472
|
+
containerHeight,
|
|
473
|
+
five,
|
|
474
|
+
modelOcclusionEnable,
|
|
475
|
+
itemLabels,
|
|
476
|
+
wrapper,
|
|
477
|
+
displayStrategyType,
|
|
478
|
+
div_elementresize_handler
|
|
479
|
+
];
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
class ItemLabelComponent extends internal.SvelteComponent {
|
|
483
|
+
constructor(options) {
|
|
484
|
+
super();
|
|
485
|
+
|
|
486
|
+
internal.init(
|
|
487
|
+
this,
|
|
488
|
+
options,
|
|
489
|
+
instance,
|
|
490
|
+
create_fragment,
|
|
491
|
+
internal.safe_not_equal,
|
|
492
|
+
{
|
|
493
|
+
five: 4,
|
|
494
|
+
modelOcclusionEnable: 5,
|
|
495
|
+
itemLabels: 6,
|
|
496
|
+
wrapper: 7,
|
|
497
|
+
hooks: 0,
|
|
498
|
+
displayStrategyType: 8
|
|
499
|
+
},
|
|
500
|
+
add_css
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/** @description 转成内部所需数据 */
|
|
506
|
+
function parseModelItemLabelPluginData(data) {
|
|
507
|
+
return data.model_item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1] + label.size[1], label.position[2]] }, label)));
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
const ModelItemLabelPlugin = (five$1, params) => {
|
|
511
|
+
var _a, _b;
|
|
512
|
+
const pluginState = {
|
|
513
|
+
container: document.createElement('div'),
|
|
514
|
+
data: null,
|
|
515
|
+
enabled: true,
|
|
516
|
+
fiveModeEnabled: undefined,
|
|
517
|
+
itemLabels: [],
|
|
518
|
+
wrapper: null,
|
|
519
|
+
app: undefined,
|
|
520
|
+
hooks: new five.Subscribe(),
|
|
521
|
+
modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
|
|
522
|
+
displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : DISPLAY_STRATEGY_TYPE.SMALL
|
|
523
|
+
};
|
|
524
|
+
pluginState.container.setAttribute('class', 'model-item-label-plugin-container');
|
|
525
|
+
pluginState.container.style.cssText = `
|
|
526
|
+
position: absolute;
|
|
527
|
+
left: 0;
|
|
528
|
+
top: 0;
|
|
529
|
+
width: 100%;
|
|
530
|
+
height: 100%;
|
|
531
|
+
pointerEvents: none;
|
|
532
|
+
`;
|
|
533
|
+
const appendTo = (wrapper) => {
|
|
534
|
+
pluginState.wrapper = wrapper;
|
|
535
|
+
wrapper.appendChild(pluginState.container);
|
|
536
|
+
render();
|
|
537
|
+
return true;
|
|
538
|
+
};
|
|
539
|
+
const load = (data) => {
|
|
540
|
+
console.log('🐶--当前标签总条数: ', data.model_item_labels.length);
|
|
541
|
+
pluginState.itemLabels = parseModelItemLabelPluginData(data);
|
|
542
|
+
render();
|
|
543
|
+
};
|
|
544
|
+
const enable = () => {
|
|
545
|
+
if (pluginState.enabled)
|
|
546
|
+
return true;
|
|
547
|
+
pluginState.enabled = true;
|
|
548
|
+
render();
|
|
549
|
+
return true;
|
|
550
|
+
};
|
|
551
|
+
const disable = () => {
|
|
552
|
+
if (!pluginState.enabled)
|
|
553
|
+
return true;
|
|
554
|
+
pluginState.enabled = false;
|
|
555
|
+
render();
|
|
556
|
+
return true;
|
|
557
|
+
};
|
|
558
|
+
const dispose = () => {
|
|
559
|
+
removeListener4Five();
|
|
560
|
+
pluginState.container.remove();
|
|
561
|
+
};
|
|
562
|
+
const handleRerender = () => {
|
|
563
|
+
if (!pluginState.enabled || !pluginState.fiveModeEnabled)
|
|
564
|
+
return;
|
|
565
|
+
disable();
|
|
566
|
+
};
|
|
567
|
+
const rerender = (a, b, c) => {
|
|
568
|
+
if (!pluginState.fiveModeEnabled)
|
|
569
|
+
return;
|
|
570
|
+
if (!c)
|
|
571
|
+
return;
|
|
572
|
+
enable();
|
|
573
|
+
render();
|
|
574
|
+
};
|
|
575
|
+
const handleInteriaPanRerender = (a, b) => {
|
|
576
|
+
if (!pluginState.fiveModeEnabled)
|
|
577
|
+
return;
|
|
578
|
+
if (!b)
|
|
579
|
+
return;
|
|
580
|
+
enable();
|
|
581
|
+
render();
|
|
582
|
+
};
|
|
583
|
+
const handleWantsPanGesture = (pose, final) => {
|
|
584
|
+
if (pose) {
|
|
585
|
+
handleRerender();
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
const handlePanGesture = (pose, final) => {
|
|
589
|
+
if (!pluginState.fiveModeEnabled)
|
|
590
|
+
return;
|
|
591
|
+
if (!final)
|
|
592
|
+
return;
|
|
593
|
+
enable();
|
|
594
|
+
render();
|
|
595
|
+
};
|
|
596
|
+
const render = () => {
|
|
597
|
+
var _a;
|
|
598
|
+
if (!pluginState.wrapper)
|
|
599
|
+
return;
|
|
600
|
+
// 只要不可展示,销毁容器
|
|
601
|
+
if (!pluginState.enabled || !pluginState.fiveModeEnabled) {
|
|
602
|
+
(_a = pluginState.app) === null || _a === void 0 ? void 0 : _a.$destroy();
|
|
603
|
+
pluginState.app = undefined;
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
// 正常显示时,分为 app 存在和不存在两种情况,如果存在,传值,不存在则初始化并传值
|
|
607
|
+
if (!pluginState.app) {
|
|
608
|
+
pluginState.app = new ItemLabelComponent({
|
|
609
|
+
target: pluginState.container,
|
|
610
|
+
props: {
|
|
611
|
+
five: five$1,
|
|
612
|
+
modelOcclusionEnable: pluginState.modelOcclusionEnable,
|
|
613
|
+
itemLabels: pluginState.itemLabels,
|
|
614
|
+
wrapper: pluginState.wrapper,
|
|
615
|
+
hooks: pluginState.hooks,
|
|
616
|
+
displayStrategyType: pluginState.displayStrategyType
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
else {
|
|
621
|
+
pluginState.app.$set({
|
|
622
|
+
five: five$1,
|
|
623
|
+
itemLabels: pluginState.itemLabels
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
// 添加 five 监听
|
|
628
|
+
const addListener4Five = () => {
|
|
629
|
+
five$1.on('modeChange', onFiveModeChange);
|
|
630
|
+
five$1.once('dispose', dispose);
|
|
631
|
+
// five.on('wantsGesture', handleRerender)
|
|
632
|
+
// five.on('gesture', rerender)
|
|
633
|
+
five$1.on('wantsMouseWheel', handleRerender);
|
|
634
|
+
five$1.on('mouseWheel', rerender);
|
|
635
|
+
five$1.on('wantsInteriaPan', handleRerender);
|
|
636
|
+
five$1.on('interiaPan', handleInteriaPanRerender);
|
|
637
|
+
five$1.on('wantsPanGesture', handleWantsPanGesture);
|
|
638
|
+
five$1.on('panGesture', handlePanGesture);
|
|
639
|
+
five$1.on('wantsPinchGesture', handleRerender);
|
|
640
|
+
five$1.on('pinchGesture', rerender);
|
|
641
|
+
};
|
|
642
|
+
// 取消 five 监听
|
|
643
|
+
const removeListener4Five = () => {
|
|
644
|
+
five$1.off('modeChange', onFiveModeChange);
|
|
645
|
+
// five.off('wantsGesture', handleRerender)
|
|
646
|
+
// five.off('gesture', rerender)
|
|
647
|
+
five$1.off('wantsMouseWheel', handleRerender);
|
|
648
|
+
five$1.off('mouseWheel', rerender);
|
|
649
|
+
five$1.off('wantsInteriaPan', handleRerender);
|
|
650
|
+
five$1.off('interiaPan', handleInteriaPanRerender);
|
|
651
|
+
five$1.off('wantsPanGesture', handleWantsPanGesture);
|
|
652
|
+
five$1.off('panGesture', handlePanGesture);
|
|
653
|
+
five$1.off('wantsPinchGesture', handleRerender);
|
|
654
|
+
five$1.off('pinchGesture', rerender);
|
|
655
|
+
};
|
|
656
|
+
const onFiveModeChange = (mode) => {
|
|
657
|
+
if (mode !== five.Five.Mode.Floorplan) {
|
|
658
|
+
pluginState.fiveModeEnabled = false;
|
|
659
|
+
render();
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
five$1.once('initAnimationEnded', () => {
|
|
663
|
+
pluginState.fiveModeEnabled = five$1.currentMode === five.Five.Mode.Floorplan;
|
|
664
|
+
render();
|
|
665
|
+
});
|
|
666
|
+
};
|
|
667
|
+
addListener4Five();
|
|
668
|
+
return {
|
|
669
|
+
appendTo,
|
|
670
|
+
load,
|
|
671
|
+
enable,
|
|
672
|
+
disable,
|
|
673
|
+
dispose,
|
|
674
|
+
hooks: pluginState.hooks
|
|
675
|
+
};
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
exports.ModelItemLabelPlugin = ModelItemLabelPlugin;
|
|
679
|
+
exports["default"] = ModelItemLabelPlugin;
|