@realsee/dnalogel 2.0.0-alpha.14 → 2.0.0-alpha.15
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 +3 -0
- package/dist/ModelItemLabelPlugin/index.js +61 -88
- package/dist/ModelItemLabelPlugin/typings.d.ts +0 -1
- package/dist/index.es.js +61 -88
- package/dist/index.js +61 -88
- package/dist/index.umd.js +61 -88
- 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/interfaces/LineJson.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
- package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
- package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
- package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
- package/docs/interfaces/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/ModelItemLabelPlugin/ItemLabelComponent.js +42 -57
- package/libs/ModelItemLabelPlugin/index.js +1 -66
- package/libs/ModelItemLabelPlugin/typings.d.ts +0 -1
- package/package.json +2 -1
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
mount_component,
|
|
18
18
|
outro_and_destroy_block,
|
|
19
19
|
safe_not_equal,
|
|
20
|
+
set_style,
|
|
20
21
|
transition_in,
|
|
21
22
|
transition_out,
|
|
22
23
|
update_keyed_each
|
|
@@ -27,6 +28,7 @@ import { beforeUpdate, onDestroy, onMount } from "svelte";
|
|
|
27
28
|
import * as THREE from 'three';
|
|
28
29
|
import ItemLabelItem from './ItemLabelItem';
|
|
29
30
|
import "./events.type";
|
|
31
|
+
import debounce from '../shared-utils/debounce';
|
|
30
32
|
|
|
31
33
|
function add_css(target) {
|
|
32
34
|
append_styles(target, "svelte-rmdeb", ".item-labels-container.svelte-rmdeb{width:100%;height:100%;position:relative}");
|
|
@@ -34,11 +36,11 @@ function add_css(target) {
|
|
|
34
36
|
|
|
35
37
|
function get_each_context(ctx, list, i) {
|
|
36
38
|
const child_ctx = ctx.slice();
|
|
37
|
-
child_ctx[
|
|
39
|
+
child_ctx[27] = list[i];
|
|
38
40
|
return child_ctx;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
// (
|
|
43
|
+
// (159:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
42
44
|
function create_each_block(key_1, ctx) {
|
|
43
45
|
let first;
|
|
44
46
|
let itemlabelitem;
|
|
@@ -46,7 +48,7 @@ function create_each_block(key_1, ctx) {
|
|
|
46
48
|
|
|
47
49
|
itemlabelitem = new ItemLabelItem({
|
|
48
50
|
props: {
|
|
49
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
51
|
+
itemLabel: /*itemLabelItem*/ ctx[27],
|
|
50
52
|
hooks: /*hooks*/ ctx[0]
|
|
51
53
|
}
|
|
52
54
|
});
|
|
@@ -67,7 +69,7 @@ function create_each_block(key_1, ctx) {
|
|
|
67
69
|
p(new_ctx, dirty) {
|
|
68
70
|
ctx = new_ctx;
|
|
69
71
|
const itemlabelitem_changes = {};
|
|
70
|
-
if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[
|
|
72
|
+
if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[27];
|
|
71
73
|
if (dirty & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
72
74
|
itemlabelitem.$set(itemlabelitem_changes);
|
|
73
75
|
},
|
|
@@ -94,7 +96,7 @@ function create_fragment(ctx) {
|
|
|
94
96
|
let div_resize_listener;
|
|
95
97
|
let current;
|
|
96
98
|
let each_value = /*renderItemLabels*/ ctx[1];
|
|
97
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
99
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[27].id;
|
|
98
100
|
|
|
99
101
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
100
102
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -111,7 +113,8 @@ function create_fragment(ctx) {
|
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
attr(div, "class", "item-labels-container svelte-rmdeb");
|
|
114
|
-
add_render_callback(() => /*div_elementresize_handler*/ ctx[
|
|
116
|
+
add_render_callback(() => /*div_elementresize_handler*/ ctx[10].call(div));
|
|
117
|
+
set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
|
|
115
118
|
},
|
|
116
119
|
m(target, anchor) {
|
|
117
120
|
insert(target, div, anchor);
|
|
@@ -120,7 +123,7 @@ function create_fragment(ctx) {
|
|
|
120
123
|
each_blocks[i].m(div, null);
|
|
121
124
|
}
|
|
122
125
|
|
|
123
|
-
div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[
|
|
126
|
+
div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[10].bind(div));
|
|
124
127
|
current = true;
|
|
125
128
|
},
|
|
126
129
|
p(ctx, [dirty]) {
|
|
@@ -130,6 +133,10 @@ function create_fragment(ctx) {
|
|
|
130
133
|
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);
|
|
131
134
|
check_outros();
|
|
132
135
|
}
|
|
136
|
+
|
|
137
|
+
if (dirty & /*itemsVisible*/ 16) {
|
|
138
|
+
set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
|
|
139
|
+
}
|
|
133
140
|
},
|
|
134
141
|
i(local) {
|
|
135
142
|
if (current) return;
|
|
@@ -179,46 +186,14 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
179
186
|
// 计算重叠
|
|
180
187
|
let cssOffsetLists = [];
|
|
181
188
|
|
|
189
|
+
// 动画过程中 itemsVisible 为 false
|
|
190
|
+
let itemsVisible = true;
|
|
191
|
+
|
|
182
192
|
/**
|
|
183
193
|
* 可见性策略:
|
|
184
194
|
* 1、当前楼层(假设先不考虑多楼层)
|
|
185
195
|
* 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
|
|
186
196
|
* */
|
|
187
|
-
// 画辅助线
|
|
188
|
-
function addHelper(x, y, z, type, helper) {
|
|
189
|
-
let geometry, materials, mesh;
|
|
190
|
-
|
|
191
|
-
if (type === 'box') {
|
|
192
|
-
geometry = new THREE.BoxGeometry(0.6, 2.5, 1.010696);
|
|
193
|
-
let mats = [];
|
|
194
|
-
|
|
195
|
-
for (let i = 0; i < geometry.faces.length; i++) {
|
|
196
|
-
const material = new THREE.MeshBasicMaterial({
|
|
197
|
-
color: new THREE.Color(Math.random() * 0xffffff)
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
mats.push(material);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
materials = mats;
|
|
204
|
-
} else if (type === 'ball') {
|
|
205
|
-
geometry = new THREE.SphereGeometry(0.02, 0.02, 64);
|
|
206
|
-
materials = new THREE.MeshBasicMaterial({ color: new THREE.Color(0xffffff) });
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
mesh = new THREE.Mesh(geometry, materials);
|
|
210
|
-
|
|
211
|
-
// y 轴需要加一半的高度,因为position是从地面开始的,或者我应该算偏移更合理
|
|
212
|
-
mesh.position.set(x, y, z);
|
|
213
|
-
|
|
214
|
-
if (helper) {
|
|
215
|
-
const helper = new THREE.AxesHelper(5);
|
|
216
|
-
mesh.add(helper);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
five.scene.add(mesh);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
197
|
const getLabelVisible = (five, itemLabel) => {
|
|
223
198
|
// 虚拟 VR 仅有一层,不考虑楼层信息
|
|
224
199
|
const raycaster = new Raycaster();
|
|
@@ -322,11 +297,22 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
322
297
|
$$invalidate(1, renderItemLabels = itemLabels);
|
|
323
298
|
curItemLabels = itemLabels;
|
|
324
299
|
onItemLabelUpdate();
|
|
325
|
-
|
|
326
|
-
// five.on('cameraUpdate', onItemLabelUpdate)
|
|
327
300
|
addResizeListener();
|
|
301
|
+
|
|
302
|
+
five.on('cameraUpdate', () => {
|
|
303
|
+
$$invalidate(4, itemsVisible = false);
|
|
304
|
+
handleCameraUpdate();
|
|
305
|
+
});
|
|
328
306
|
});
|
|
329
307
|
|
|
308
|
+
const handleCameraUpdate = debounce(
|
|
309
|
+
() => {
|
|
310
|
+
$$invalidate(4, itemsVisible = true);
|
|
311
|
+
onItemLabelUpdate();
|
|
312
|
+
},
|
|
313
|
+
300
|
|
314
|
+
);
|
|
315
|
+
|
|
330
316
|
const addResizeListener = () => {
|
|
331
317
|
wrapperSize = {
|
|
332
318
|
width: wrapper.clientWidth,
|
|
@@ -340,7 +326,6 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
340
326
|
if (curItemLabels !== itemLabels) {
|
|
341
327
|
$$invalidate(1, renderItemLabels = itemLabels);
|
|
342
328
|
curItemLabels = itemLabels;
|
|
343
|
-
console.log('--debug--update--');
|
|
344
329
|
onItemLabelUpdate();
|
|
345
330
|
}
|
|
346
331
|
};
|
|
@@ -358,9 +343,8 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
358
343
|
});
|
|
359
344
|
|
|
360
345
|
onDestroy(() => {
|
|
361
|
-
|
|
346
|
+
five.off('cameraUpdate');
|
|
362
347
|
resizeObserver.unobserve(wrapper);
|
|
363
|
-
|
|
364
348
|
curItemLabels = null;
|
|
365
349
|
$$invalidate(1, renderItemLabels = null);
|
|
366
350
|
wrapperSize = { width: 0, height: 0 };
|
|
@@ -374,12 +358,12 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
374
358
|
}
|
|
375
359
|
|
|
376
360
|
$$self.$$set = $$props => {
|
|
377
|
-
if ('five' in $$props) $$invalidate(
|
|
378
|
-
if ('modelOcclusionEnable' in $$props) $$invalidate(
|
|
379
|
-
if ('itemLabels' in $$props) $$invalidate(
|
|
380
|
-
if ('wrapper' in $$props) $$invalidate(
|
|
361
|
+
if ('five' in $$props) $$invalidate(5, five = $$props.five);
|
|
362
|
+
if ('modelOcclusionEnable' in $$props) $$invalidate(6, modelOcclusionEnable = $$props.modelOcclusionEnable);
|
|
363
|
+
if ('itemLabels' in $$props) $$invalidate(7, itemLabels = $$props.itemLabels);
|
|
364
|
+
if ('wrapper' in $$props) $$invalidate(8, wrapper = $$props.wrapper);
|
|
381
365
|
if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
|
|
382
|
-
if ('displayStrategyType' in $$props) $$invalidate(
|
|
366
|
+
if ('displayStrategyType' in $$props) $$invalidate(9, displayStrategyType = $$props.displayStrategyType);
|
|
383
367
|
};
|
|
384
368
|
|
|
385
369
|
return [
|
|
@@ -387,6 +371,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
387
371
|
renderItemLabels,
|
|
388
372
|
containerWidth,
|
|
389
373
|
containerHeight,
|
|
374
|
+
itemsVisible,
|
|
390
375
|
five,
|
|
391
376
|
modelOcclusionEnable,
|
|
392
377
|
itemLabels,
|
|
@@ -407,12 +392,12 @@ class Component extends SvelteComponent {
|
|
|
407
392
|
create_fragment,
|
|
408
393
|
safe_not_equal,
|
|
409
394
|
{
|
|
410
|
-
five:
|
|
411
|
-
modelOcclusionEnable:
|
|
412
|
-
itemLabels:
|
|
413
|
-
wrapper:
|
|
395
|
+
five: 5,
|
|
396
|
+
modelOcclusionEnable: 6,
|
|
397
|
+
itemLabels: 7,
|
|
398
|
+
wrapper: 8,
|
|
414
399
|
hooks: 0,
|
|
415
|
-
displayStrategyType:
|
|
400
|
+
displayStrategyType: 9
|
|
416
401
|
},
|
|
417
402
|
add_css
|
|
418
403
|
);
|
|
@@ -15,7 +15,6 @@ export const ModelItemLabelPlugin = (five, params) => {
|
|
|
15
15
|
hooks: new Subscribe(),
|
|
16
16
|
modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
|
|
17
17
|
displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : DISPLAY_STRATEGY_TYPE.SMALL,
|
|
18
|
-
pending: false
|
|
19
18
|
};
|
|
20
19
|
pluginState.container.setAttribute('class', 'model-item-label-plugin-container');
|
|
21
20
|
pluginState.container.style.cssText = `
|
|
@@ -54,50 +53,6 @@ export const ModelItemLabelPlugin = (five, params) => {
|
|
|
54
53
|
removeListener4Five();
|
|
55
54
|
pluginState.container.remove();
|
|
56
55
|
};
|
|
57
|
-
const handleRerender = () => {
|
|
58
|
-
if (!pluginState.enabled || !pluginState.fiveModeEnabled || pluginState.pending)
|
|
59
|
-
return;
|
|
60
|
-
pluginState.pending = true;
|
|
61
|
-
disable();
|
|
62
|
-
};
|
|
63
|
-
const rerender = (a, b, c) => {
|
|
64
|
-
if (!pluginState.pending)
|
|
65
|
-
return;
|
|
66
|
-
if (!pluginState.fiveModeEnabled)
|
|
67
|
-
return;
|
|
68
|
-
if (!c)
|
|
69
|
-
return;
|
|
70
|
-
pluginState.pending = false;
|
|
71
|
-
enable();
|
|
72
|
-
render();
|
|
73
|
-
};
|
|
74
|
-
const handleInteriaPanRerender = (a, b) => {
|
|
75
|
-
if (!pluginState.pending)
|
|
76
|
-
return;
|
|
77
|
-
if (!pluginState.fiveModeEnabled)
|
|
78
|
-
return;
|
|
79
|
-
if (!b)
|
|
80
|
-
return;
|
|
81
|
-
pluginState.pending = false;
|
|
82
|
-
enable();
|
|
83
|
-
render();
|
|
84
|
-
};
|
|
85
|
-
const handleWantsPanGesture = (pose, final) => {
|
|
86
|
-
if (pose) {
|
|
87
|
-
handleRerender();
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
const handlePanGesture = (pose, final) => {
|
|
91
|
-
if (!pluginState.pending)
|
|
92
|
-
return;
|
|
93
|
-
if (!pluginState.fiveModeEnabled)
|
|
94
|
-
return;
|
|
95
|
-
if (!final)
|
|
96
|
-
return;
|
|
97
|
-
pluginState.pending = false;
|
|
98
|
-
enable();
|
|
99
|
-
render();
|
|
100
|
-
};
|
|
101
56
|
const render = () => {
|
|
102
57
|
var _a;
|
|
103
58
|
if (!pluginState.wrapper)
|
|
@@ -133,33 +88,13 @@ export const ModelItemLabelPlugin = (five, params) => {
|
|
|
133
88
|
const addListener4Five = () => {
|
|
134
89
|
five.on('modeChange', onFiveModeChange);
|
|
135
90
|
five.once('dispose', dispose);
|
|
136
|
-
// five.on('wantsGesture', handleRerender)
|
|
137
|
-
// five.on('gesture', rerender)
|
|
138
|
-
five.on('wantsMouseWheel', handleRerender);
|
|
139
|
-
five.on('mouseWheel', rerender);
|
|
140
|
-
five.on('wantsInteriaPan', handleRerender);
|
|
141
|
-
five.on('interiaPan', handleInteriaPanRerender);
|
|
142
|
-
five.on('wantsPanGesture', handleWantsPanGesture);
|
|
143
|
-
five.on('panGesture', handlePanGesture);
|
|
144
|
-
five.on('wantsPinchGesture', handleRerender);
|
|
145
|
-
five.on('pinchGesture', rerender);
|
|
146
91
|
};
|
|
147
92
|
// 取消 five 监听
|
|
148
93
|
const removeListener4Five = () => {
|
|
149
94
|
five.off('modeChange', onFiveModeChange);
|
|
150
|
-
// five.off('wantsGesture', handleRerender)
|
|
151
|
-
// five.off('gesture', rerender)
|
|
152
|
-
five.off('wantsMouseWheel', handleRerender);
|
|
153
|
-
five.off('mouseWheel', rerender);
|
|
154
|
-
five.off('wantsInteriaPan', handleRerender);
|
|
155
|
-
five.off('interiaPan', handleInteriaPanRerender);
|
|
156
|
-
five.off('wantsPanGesture', handleWantsPanGesture);
|
|
157
|
-
five.off('panGesture', handlePanGesture);
|
|
158
|
-
five.off('wantsPinchGesture', handleRerender);
|
|
159
|
-
five.off('pinchGesture', rerender);
|
|
160
95
|
};
|
|
161
96
|
const onFiveModeChange = (mode) => {
|
|
162
|
-
if (!pluginState.enabled
|
|
97
|
+
if (!pluginState.enabled)
|
|
163
98
|
return;
|
|
164
99
|
if (mode !== Five.Mode.Floorplan) {
|
|
165
100
|
pluginState.fiveModeEnabled = false;
|
package/package.json
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "REALSEE-DEVELOPER",
|
|
7
7
|
"repository": "https://github.com/realsee-developer/dnalogel.git",
|
|
8
|
+
"description": "如视 VR 看房插件合集",
|
|
8
9
|
"private": false,
|
|
9
|
-
"version": "2.0.0-alpha.
|
|
10
|
+
"version": "2.0.0-alpha.15",
|
|
10
11
|
"license": "SEE LICENSE IN TERMS.txt",
|
|
11
12
|
"scripts": {
|
|
12
13
|
"build": "yarn run tsb && yarn run build:rollup && yarn build:docs",
|