@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
package/CHANGELOG.md
CHANGED
|
@@ -149,6 +149,21 @@ class ItemLabelItem extends internal.SvelteComponent {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* 创建一个防抖动函数,该函数会在 wait 毫秒后调用 func 方法
|
|
154
|
+
* @param func - 要防抖动的函数
|
|
155
|
+
* @param [wait=0] - 需要延迟的毫秒数
|
|
156
|
+
*/
|
|
157
|
+
function debounce(func, wait = 200) {
|
|
158
|
+
let last;
|
|
159
|
+
return function (...args) {
|
|
160
|
+
clearTimeout(last);
|
|
161
|
+
last = setTimeout(() => {
|
|
162
|
+
func(...args);
|
|
163
|
+
}, wait);
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
152
167
|
/* src/ModelItemLabelPlugin/ItemLabelComponent.svelte generated by Svelte v3.47.0 */
|
|
153
168
|
|
|
154
169
|
function add_css(target) {
|
|
@@ -157,11 +172,11 @@ function add_css(target) {
|
|
|
157
172
|
|
|
158
173
|
function get_each_context(ctx, list, i) {
|
|
159
174
|
const child_ctx = ctx.slice();
|
|
160
|
-
child_ctx[
|
|
175
|
+
child_ctx[27] = list[i];
|
|
161
176
|
return child_ctx;
|
|
162
177
|
}
|
|
163
178
|
|
|
164
|
-
// (
|
|
179
|
+
// (159:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
165
180
|
function create_each_block(key_1, ctx) {
|
|
166
181
|
let first;
|
|
167
182
|
let itemlabelitem;
|
|
@@ -169,7 +184,7 @@ function create_each_block(key_1, ctx) {
|
|
|
169
184
|
|
|
170
185
|
itemlabelitem = new ItemLabelItem({
|
|
171
186
|
props: {
|
|
172
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
187
|
+
itemLabel: /*itemLabelItem*/ ctx[27],
|
|
173
188
|
hooks: /*hooks*/ ctx[0]
|
|
174
189
|
}
|
|
175
190
|
});
|
|
@@ -190,7 +205,7 @@ function create_each_block(key_1, ctx) {
|
|
|
190
205
|
p(new_ctx, dirty) {
|
|
191
206
|
ctx = new_ctx;
|
|
192
207
|
const itemlabelitem_changes = {};
|
|
193
|
-
if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[
|
|
208
|
+
if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[27];
|
|
194
209
|
if (dirty & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
195
210
|
itemlabelitem.$set(itemlabelitem_changes);
|
|
196
211
|
},
|
|
@@ -217,7 +232,7 @@ function create_fragment(ctx) {
|
|
|
217
232
|
let div_resize_listener;
|
|
218
233
|
let current;
|
|
219
234
|
let each_value = /*renderItemLabels*/ ctx[1];
|
|
220
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
235
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[27].id;
|
|
221
236
|
|
|
222
237
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
223
238
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -234,7 +249,8 @@ function create_fragment(ctx) {
|
|
|
234
249
|
}
|
|
235
250
|
|
|
236
251
|
internal.attr(div, "class", "item-labels-container svelte-rmdeb");
|
|
237
|
-
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[
|
|
252
|
+
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[10].call(div));
|
|
253
|
+
internal.set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
|
|
238
254
|
},
|
|
239
255
|
m(target, anchor) {
|
|
240
256
|
internal.insert(target, div, anchor);
|
|
@@ -243,7 +259,7 @@ function create_fragment(ctx) {
|
|
|
243
259
|
each_blocks[i].m(div, null);
|
|
244
260
|
}
|
|
245
261
|
|
|
246
|
-
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[
|
|
262
|
+
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[10].bind(div));
|
|
247
263
|
current = true;
|
|
248
264
|
},
|
|
249
265
|
p(ctx, [dirty]) {
|
|
@@ -253,6 +269,10 @@ function create_fragment(ctx) {
|
|
|
253
269
|
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
270
|
internal.check_outros();
|
|
255
271
|
}
|
|
272
|
+
|
|
273
|
+
if (dirty & /*itemsVisible*/ 16) {
|
|
274
|
+
internal.set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
|
|
275
|
+
}
|
|
256
276
|
},
|
|
257
277
|
i(local) {
|
|
258
278
|
if (current) return;
|
|
@@ -302,6 +322,14 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
302
322
|
// 计算重叠
|
|
303
323
|
let cssOffsetLists = [];
|
|
304
324
|
|
|
325
|
+
// 动画过程中 itemsVisible 为 false
|
|
326
|
+
let itemsVisible = true;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* 可见性策略:
|
|
330
|
+
* 1、当前楼层(假设先不考虑多楼层)
|
|
331
|
+
* 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
|
|
332
|
+
* */
|
|
305
333
|
const getLabelVisible = (five, itemLabel) => {
|
|
306
334
|
// 虚拟 VR 仅有一层,不考虑楼层信息
|
|
307
335
|
const raycaster = new Raycaster();
|
|
@@ -405,11 +433,22 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
405
433
|
$$invalidate(1, renderItemLabels = itemLabels);
|
|
406
434
|
curItemLabels = itemLabels;
|
|
407
435
|
onItemLabelUpdate();
|
|
408
|
-
|
|
409
|
-
// five.on('cameraUpdate', onItemLabelUpdate)
|
|
410
436
|
addResizeListener();
|
|
437
|
+
|
|
438
|
+
five.on('cameraUpdate', () => {
|
|
439
|
+
$$invalidate(4, itemsVisible = false);
|
|
440
|
+
handleCameraUpdate();
|
|
441
|
+
});
|
|
411
442
|
});
|
|
412
443
|
|
|
444
|
+
const handleCameraUpdate = debounce(
|
|
445
|
+
() => {
|
|
446
|
+
$$invalidate(4, itemsVisible = true);
|
|
447
|
+
onItemLabelUpdate();
|
|
448
|
+
},
|
|
449
|
+
300
|
|
450
|
+
);
|
|
451
|
+
|
|
413
452
|
const addResizeListener = () => {
|
|
414
453
|
wrapperSize = {
|
|
415
454
|
width: wrapper.clientWidth,
|
|
@@ -423,7 +462,6 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
423
462
|
if (curItemLabels !== itemLabels) {
|
|
424
463
|
$$invalidate(1, renderItemLabels = itemLabels);
|
|
425
464
|
curItemLabels = itemLabels;
|
|
426
|
-
console.log('--debug--update--');
|
|
427
465
|
onItemLabelUpdate();
|
|
428
466
|
}
|
|
429
467
|
};
|
|
@@ -441,9 +479,8 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
441
479
|
});
|
|
442
480
|
|
|
443
481
|
svelte.onDestroy(() => {
|
|
444
|
-
|
|
482
|
+
five.off('cameraUpdate');
|
|
445
483
|
resizeObserver.unobserve(wrapper);
|
|
446
|
-
|
|
447
484
|
curItemLabels = null;
|
|
448
485
|
$$invalidate(1, renderItemLabels = null);
|
|
449
486
|
wrapperSize = { width: 0, height: 0 };
|
|
@@ -457,12 +494,12 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
457
494
|
}
|
|
458
495
|
|
|
459
496
|
$$self.$$set = $$props => {
|
|
460
|
-
if ('five' in $$props) $$invalidate(
|
|
461
|
-
if ('modelOcclusionEnable' in $$props) $$invalidate(
|
|
462
|
-
if ('itemLabels' in $$props) $$invalidate(
|
|
463
|
-
if ('wrapper' in $$props) $$invalidate(
|
|
497
|
+
if ('five' in $$props) $$invalidate(5, five = $$props.five);
|
|
498
|
+
if ('modelOcclusionEnable' in $$props) $$invalidate(6, modelOcclusionEnable = $$props.modelOcclusionEnable);
|
|
499
|
+
if ('itemLabels' in $$props) $$invalidate(7, itemLabels = $$props.itemLabels);
|
|
500
|
+
if ('wrapper' in $$props) $$invalidate(8, wrapper = $$props.wrapper);
|
|
464
501
|
if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
|
|
465
|
-
if ('displayStrategyType' in $$props) $$invalidate(
|
|
502
|
+
if ('displayStrategyType' in $$props) $$invalidate(9, displayStrategyType = $$props.displayStrategyType);
|
|
466
503
|
};
|
|
467
504
|
|
|
468
505
|
return [
|
|
@@ -470,6 +507,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
470
507
|
renderItemLabels,
|
|
471
508
|
containerWidth,
|
|
472
509
|
containerHeight,
|
|
510
|
+
itemsVisible,
|
|
473
511
|
five,
|
|
474
512
|
modelOcclusionEnable,
|
|
475
513
|
itemLabels,
|
|
@@ -490,12 +528,12 @@ class ItemLabelComponent extends internal.SvelteComponent {
|
|
|
490
528
|
create_fragment,
|
|
491
529
|
internal.safe_not_equal,
|
|
492
530
|
{
|
|
493
|
-
five:
|
|
494
|
-
modelOcclusionEnable:
|
|
495
|
-
itemLabels:
|
|
496
|
-
wrapper:
|
|
531
|
+
five: 5,
|
|
532
|
+
modelOcclusionEnable: 6,
|
|
533
|
+
itemLabels: 7,
|
|
534
|
+
wrapper: 8,
|
|
497
535
|
hooks: 0,
|
|
498
|
-
displayStrategyType:
|
|
536
|
+
displayStrategyType: 9
|
|
499
537
|
},
|
|
500
538
|
add_css
|
|
501
539
|
);
|
|
@@ -520,7 +558,6 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
520
558
|
hooks: new five.Subscribe(),
|
|
521
559
|
modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
|
|
522
560
|
displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : DISPLAY_STRATEGY_TYPE.SMALL,
|
|
523
|
-
pending: false
|
|
524
561
|
};
|
|
525
562
|
pluginState.container.setAttribute('class', 'model-item-label-plugin-container');
|
|
526
563
|
pluginState.container.style.cssText = `
|
|
@@ -559,50 +596,6 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
559
596
|
removeListener4Five();
|
|
560
597
|
pluginState.container.remove();
|
|
561
598
|
};
|
|
562
|
-
const handleRerender = () => {
|
|
563
|
-
if (!pluginState.enabled || !pluginState.fiveModeEnabled || pluginState.pending)
|
|
564
|
-
return;
|
|
565
|
-
pluginState.pending = true;
|
|
566
|
-
disable();
|
|
567
|
-
};
|
|
568
|
-
const rerender = (a, b, c) => {
|
|
569
|
-
if (!pluginState.pending)
|
|
570
|
-
return;
|
|
571
|
-
if (!pluginState.fiveModeEnabled)
|
|
572
|
-
return;
|
|
573
|
-
if (!c)
|
|
574
|
-
return;
|
|
575
|
-
pluginState.pending = false;
|
|
576
|
-
enable();
|
|
577
|
-
render();
|
|
578
|
-
};
|
|
579
|
-
const handleInteriaPanRerender = (a, b) => {
|
|
580
|
-
if (!pluginState.pending)
|
|
581
|
-
return;
|
|
582
|
-
if (!pluginState.fiveModeEnabled)
|
|
583
|
-
return;
|
|
584
|
-
if (!b)
|
|
585
|
-
return;
|
|
586
|
-
pluginState.pending = false;
|
|
587
|
-
enable();
|
|
588
|
-
render();
|
|
589
|
-
};
|
|
590
|
-
const handleWantsPanGesture = (pose, final) => {
|
|
591
|
-
if (pose) {
|
|
592
|
-
handleRerender();
|
|
593
|
-
}
|
|
594
|
-
};
|
|
595
|
-
const handlePanGesture = (pose, final) => {
|
|
596
|
-
if (!pluginState.pending)
|
|
597
|
-
return;
|
|
598
|
-
if (!pluginState.fiveModeEnabled)
|
|
599
|
-
return;
|
|
600
|
-
if (!final)
|
|
601
|
-
return;
|
|
602
|
-
pluginState.pending = false;
|
|
603
|
-
enable();
|
|
604
|
-
render();
|
|
605
|
-
};
|
|
606
599
|
const render = () => {
|
|
607
600
|
var _a;
|
|
608
601
|
if (!pluginState.wrapper)
|
|
@@ -638,33 +631,13 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
638
631
|
const addListener4Five = () => {
|
|
639
632
|
five$1.on('modeChange', onFiveModeChange);
|
|
640
633
|
five$1.once('dispose', dispose);
|
|
641
|
-
// five.on('wantsGesture', handleRerender)
|
|
642
|
-
// five.on('gesture', rerender)
|
|
643
|
-
five$1.on('wantsMouseWheel', handleRerender);
|
|
644
|
-
five$1.on('mouseWheel', rerender);
|
|
645
|
-
five$1.on('wantsInteriaPan', handleRerender);
|
|
646
|
-
five$1.on('interiaPan', handleInteriaPanRerender);
|
|
647
|
-
five$1.on('wantsPanGesture', handleWantsPanGesture);
|
|
648
|
-
five$1.on('panGesture', handlePanGesture);
|
|
649
|
-
five$1.on('wantsPinchGesture', handleRerender);
|
|
650
|
-
five$1.on('pinchGesture', rerender);
|
|
651
634
|
};
|
|
652
635
|
// 取消 five 监听
|
|
653
636
|
const removeListener4Five = () => {
|
|
654
637
|
five$1.off('modeChange', onFiveModeChange);
|
|
655
|
-
// five.off('wantsGesture', handleRerender)
|
|
656
|
-
// five.off('gesture', rerender)
|
|
657
|
-
five$1.off('wantsMouseWheel', handleRerender);
|
|
658
|
-
five$1.off('mouseWheel', rerender);
|
|
659
|
-
five$1.off('wantsInteriaPan', handleRerender);
|
|
660
|
-
five$1.off('interiaPan', handleInteriaPanRerender);
|
|
661
|
-
five$1.off('wantsPanGesture', handleWantsPanGesture);
|
|
662
|
-
five$1.off('panGesture', handlePanGesture);
|
|
663
|
-
five$1.off('wantsPinchGesture', handleRerender);
|
|
664
|
-
five$1.off('pinchGesture', rerender);
|
|
665
638
|
};
|
|
666
639
|
const onFiveModeChange = (mode) => {
|
|
667
|
-
if (!pluginState.enabled
|
|
640
|
+
if (!pluginState.enabled)
|
|
668
641
|
return;
|
|
669
642
|
if (mode !== five.Five.Mode.Floorplan) {
|
|
670
643
|
pluginState.fiveModeEnabled = false;
|
package/dist/index.es.js
CHANGED
|
@@ -14365,6 +14365,21 @@ class ItemLabelItem extends SvelteComponent {
|
|
|
14365
14365
|
}
|
|
14366
14366
|
}
|
|
14367
14367
|
|
|
14368
|
+
/**
|
|
14369
|
+
* 创建一个防抖动函数,该函数会在 wait 毫秒后调用 func 方法
|
|
14370
|
+
* @param func - 要防抖动的函数
|
|
14371
|
+
* @param [wait=0] - 需要延迟的毫秒数
|
|
14372
|
+
*/
|
|
14373
|
+
function debounce(func, wait = 200) {
|
|
14374
|
+
let last;
|
|
14375
|
+
return function (...args) {
|
|
14376
|
+
clearTimeout(last);
|
|
14377
|
+
last = setTimeout(() => {
|
|
14378
|
+
func(...args);
|
|
14379
|
+
}, wait);
|
|
14380
|
+
};
|
|
14381
|
+
}
|
|
14382
|
+
|
|
14368
14383
|
/* src/ModelItemLabelPlugin/ItemLabelComponent.svelte generated by Svelte v3.47.0 */
|
|
14369
14384
|
|
|
14370
14385
|
function add_css(target) {
|
|
@@ -14373,11 +14388,11 @@ function add_css(target) {
|
|
|
14373
14388
|
|
|
14374
14389
|
function get_each_context(ctx, list, i) {
|
|
14375
14390
|
const child_ctx = ctx.slice();
|
|
14376
|
-
child_ctx[
|
|
14391
|
+
child_ctx[27] = list[i];
|
|
14377
14392
|
return child_ctx;
|
|
14378
14393
|
}
|
|
14379
14394
|
|
|
14380
|
-
// (
|
|
14395
|
+
// (159:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
14381
14396
|
function create_each_block(key_1, ctx) {
|
|
14382
14397
|
let first;
|
|
14383
14398
|
let itemlabelitem;
|
|
@@ -14385,7 +14400,7 @@ function create_each_block(key_1, ctx) {
|
|
|
14385
14400
|
|
|
14386
14401
|
itemlabelitem = new ItemLabelItem({
|
|
14387
14402
|
props: {
|
|
14388
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
14403
|
+
itemLabel: /*itemLabelItem*/ ctx[27],
|
|
14389
14404
|
hooks: /*hooks*/ ctx[0]
|
|
14390
14405
|
}
|
|
14391
14406
|
});
|
|
@@ -14406,7 +14421,7 @@ function create_each_block(key_1, ctx) {
|
|
|
14406
14421
|
p(new_ctx, dirty) {
|
|
14407
14422
|
ctx = new_ctx;
|
|
14408
14423
|
const itemlabelitem_changes = {};
|
|
14409
|
-
if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[
|
|
14424
|
+
if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[27];
|
|
14410
14425
|
if (dirty & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
14411
14426
|
itemlabelitem.$set(itemlabelitem_changes);
|
|
14412
14427
|
},
|
|
@@ -14433,7 +14448,7 @@ function create_fragment(ctx) {
|
|
|
14433
14448
|
let div_resize_listener;
|
|
14434
14449
|
let current;
|
|
14435
14450
|
let each_value = /*renderItemLabels*/ ctx[1];
|
|
14436
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
14451
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[27].id;
|
|
14437
14452
|
|
|
14438
14453
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
14439
14454
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -14450,7 +14465,8 @@ function create_fragment(ctx) {
|
|
|
14450
14465
|
}
|
|
14451
14466
|
|
|
14452
14467
|
attr(div, "class", "item-labels-container svelte-rmdeb");
|
|
14453
|
-
add_render_callback(() => /*div_elementresize_handler*/ ctx[
|
|
14468
|
+
add_render_callback(() => /*div_elementresize_handler*/ ctx[10].call(div));
|
|
14469
|
+
set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
|
|
14454
14470
|
},
|
|
14455
14471
|
m(target, anchor) {
|
|
14456
14472
|
insert(target, div, anchor);
|
|
@@ -14459,7 +14475,7 @@ function create_fragment(ctx) {
|
|
|
14459
14475
|
each_blocks[i].m(div, null);
|
|
14460
14476
|
}
|
|
14461
14477
|
|
|
14462
|
-
div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[
|
|
14478
|
+
div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[10].bind(div));
|
|
14463
14479
|
current = true;
|
|
14464
14480
|
},
|
|
14465
14481
|
p(ctx, [dirty]) {
|
|
@@ -14469,6 +14485,10 @@ function create_fragment(ctx) {
|
|
|
14469
14485
|
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);
|
|
14470
14486
|
check_outros();
|
|
14471
14487
|
}
|
|
14488
|
+
|
|
14489
|
+
if (dirty & /*itemsVisible*/ 16) {
|
|
14490
|
+
set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
|
|
14491
|
+
}
|
|
14472
14492
|
},
|
|
14473
14493
|
i(local) {
|
|
14474
14494
|
if (current) return;
|
|
@@ -14518,6 +14538,14 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14518
14538
|
// 计算重叠
|
|
14519
14539
|
let cssOffsetLists = [];
|
|
14520
14540
|
|
|
14541
|
+
// 动画过程中 itemsVisible 为 false
|
|
14542
|
+
let itemsVisible = true;
|
|
14543
|
+
|
|
14544
|
+
/**
|
|
14545
|
+
* 可见性策略:
|
|
14546
|
+
* 1、当前楼层(假设先不考虑多楼层)
|
|
14547
|
+
* 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
|
|
14548
|
+
* */
|
|
14521
14549
|
const getLabelVisible = (five, itemLabel) => {
|
|
14522
14550
|
// 虚拟 VR 仅有一层,不考虑楼层信息
|
|
14523
14551
|
const raycaster = new Raycaster();
|
|
@@ -14621,11 +14649,22 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14621
14649
|
$$invalidate(1, renderItemLabels = itemLabels);
|
|
14622
14650
|
curItemLabels = itemLabels;
|
|
14623
14651
|
onItemLabelUpdate();
|
|
14624
|
-
|
|
14625
|
-
// five.on('cameraUpdate', onItemLabelUpdate)
|
|
14626
14652
|
addResizeListener();
|
|
14653
|
+
|
|
14654
|
+
five.on('cameraUpdate', () => {
|
|
14655
|
+
$$invalidate(4, itemsVisible = false);
|
|
14656
|
+
handleCameraUpdate();
|
|
14657
|
+
});
|
|
14627
14658
|
});
|
|
14628
14659
|
|
|
14660
|
+
const handleCameraUpdate = debounce(
|
|
14661
|
+
() => {
|
|
14662
|
+
$$invalidate(4, itemsVisible = true);
|
|
14663
|
+
onItemLabelUpdate();
|
|
14664
|
+
},
|
|
14665
|
+
300
|
|
14666
|
+
);
|
|
14667
|
+
|
|
14629
14668
|
const addResizeListener = () => {
|
|
14630
14669
|
wrapperSize = {
|
|
14631
14670
|
width: wrapper.clientWidth,
|
|
@@ -14639,7 +14678,6 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14639
14678
|
if (curItemLabels !== itemLabels) {
|
|
14640
14679
|
$$invalidate(1, renderItemLabels = itemLabels);
|
|
14641
14680
|
curItemLabels = itemLabels;
|
|
14642
|
-
console.log('--debug--update--');
|
|
14643
14681
|
onItemLabelUpdate();
|
|
14644
14682
|
}
|
|
14645
14683
|
};
|
|
@@ -14657,9 +14695,8 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14657
14695
|
});
|
|
14658
14696
|
|
|
14659
14697
|
onDestroy(() => {
|
|
14660
|
-
|
|
14698
|
+
five.off('cameraUpdate');
|
|
14661
14699
|
resizeObserver.unobserve(wrapper);
|
|
14662
|
-
|
|
14663
14700
|
curItemLabels = null;
|
|
14664
14701
|
$$invalidate(1, renderItemLabels = null);
|
|
14665
14702
|
wrapperSize = { width: 0, height: 0 };
|
|
@@ -14673,12 +14710,12 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14673
14710
|
}
|
|
14674
14711
|
|
|
14675
14712
|
$$self.$$set = $$props => {
|
|
14676
|
-
if ('five' in $$props) $$invalidate(
|
|
14677
|
-
if ('modelOcclusionEnable' in $$props) $$invalidate(
|
|
14678
|
-
if ('itemLabels' in $$props) $$invalidate(
|
|
14679
|
-
if ('wrapper' in $$props) $$invalidate(
|
|
14713
|
+
if ('five' in $$props) $$invalidate(5, five = $$props.five);
|
|
14714
|
+
if ('modelOcclusionEnable' in $$props) $$invalidate(6, modelOcclusionEnable = $$props.modelOcclusionEnable);
|
|
14715
|
+
if ('itemLabels' in $$props) $$invalidate(7, itemLabels = $$props.itemLabels);
|
|
14716
|
+
if ('wrapper' in $$props) $$invalidate(8, wrapper = $$props.wrapper);
|
|
14680
14717
|
if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
|
|
14681
|
-
if ('displayStrategyType' in $$props) $$invalidate(
|
|
14718
|
+
if ('displayStrategyType' in $$props) $$invalidate(9, displayStrategyType = $$props.displayStrategyType);
|
|
14682
14719
|
};
|
|
14683
14720
|
|
|
14684
14721
|
return [
|
|
@@ -14686,6 +14723,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14686
14723
|
renderItemLabels,
|
|
14687
14724
|
containerWidth,
|
|
14688
14725
|
containerHeight,
|
|
14726
|
+
itemsVisible,
|
|
14689
14727
|
five,
|
|
14690
14728
|
modelOcclusionEnable,
|
|
14691
14729
|
itemLabels,
|
|
@@ -14706,12 +14744,12 @@ class ItemLabelComponent extends SvelteComponent {
|
|
|
14706
14744
|
create_fragment,
|
|
14707
14745
|
safe_not_equal,
|
|
14708
14746
|
{
|
|
14709
|
-
five:
|
|
14710
|
-
modelOcclusionEnable:
|
|
14711
|
-
itemLabels:
|
|
14712
|
-
wrapper:
|
|
14747
|
+
five: 5,
|
|
14748
|
+
modelOcclusionEnable: 6,
|
|
14749
|
+
itemLabels: 7,
|
|
14750
|
+
wrapper: 8,
|
|
14713
14751
|
hooks: 0,
|
|
14714
|
-
displayStrategyType:
|
|
14752
|
+
displayStrategyType: 9
|
|
14715
14753
|
},
|
|
14716
14754
|
add_css
|
|
14717
14755
|
);
|
|
@@ -14736,7 +14774,6 @@ const ModelItemLabelPlugin = (five, params) => {
|
|
|
14736
14774
|
hooks: new Subscribe(),
|
|
14737
14775
|
modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
|
|
14738
14776
|
displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : DISPLAY_STRATEGY_TYPE.SMALL,
|
|
14739
|
-
pending: false
|
|
14740
14777
|
};
|
|
14741
14778
|
pluginState.container.setAttribute('class', 'model-item-label-plugin-container');
|
|
14742
14779
|
pluginState.container.style.cssText = `
|
|
@@ -14775,50 +14812,6 @@ const ModelItemLabelPlugin = (five, params) => {
|
|
|
14775
14812
|
removeListener4Five();
|
|
14776
14813
|
pluginState.container.remove();
|
|
14777
14814
|
};
|
|
14778
|
-
const handleRerender = () => {
|
|
14779
|
-
if (!pluginState.enabled || !pluginState.fiveModeEnabled || pluginState.pending)
|
|
14780
|
-
return;
|
|
14781
|
-
pluginState.pending = true;
|
|
14782
|
-
disable();
|
|
14783
|
-
};
|
|
14784
|
-
const rerender = (a, b, c) => {
|
|
14785
|
-
if (!pluginState.pending)
|
|
14786
|
-
return;
|
|
14787
|
-
if (!pluginState.fiveModeEnabled)
|
|
14788
|
-
return;
|
|
14789
|
-
if (!c)
|
|
14790
|
-
return;
|
|
14791
|
-
pluginState.pending = false;
|
|
14792
|
-
enable();
|
|
14793
|
-
render();
|
|
14794
|
-
};
|
|
14795
|
-
const handleInteriaPanRerender = (a, b) => {
|
|
14796
|
-
if (!pluginState.pending)
|
|
14797
|
-
return;
|
|
14798
|
-
if (!pluginState.fiveModeEnabled)
|
|
14799
|
-
return;
|
|
14800
|
-
if (!b)
|
|
14801
|
-
return;
|
|
14802
|
-
pluginState.pending = false;
|
|
14803
|
-
enable();
|
|
14804
|
-
render();
|
|
14805
|
-
};
|
|
14806
|
-
const handleWantsPanGesture = (pose, final) => {
|
|
14807
|
-
if (pose) {
|
|
14808
|
-
handleRerender();
|
|
14809
|
-
}
|
|
14810
|
-
};
|
|
14811
|
-
const handlePanGesture = (pose, final) => {
|
|
14812
|
-
if (!pluginState.pending)
|
|
14813
|
-
return;
|
|
14814
|
-
if (!pluginState.fiveModeEnabled)
|
|
14815
|
-
return;
|
|
14816
|
-
if (!final)
|
|
14817
|
-
return;
|
|
14818
|
-
pluginState.pending = false;
|
|
14819
|
-
enable();
|
|
14820
|
-
render();
|
|
14821
|
-
};
|
|
14822
14815
|
const render = () => {
|
|
14823
14816
|
var _a;
|
|
14824
14817
|
if (!pluginState.wrapper)
|
|
@@ -14854,33 +14847,13 @@ const ModelItemLabelPlugin = (five, params) => {
|
|
|
14854
14847
|
const addListener4Five = () => {
|
|
14855
14848
|
five.on('modeChange', onFiveModeChange);
|
|
14856
14849
|
five.once('dispose', dispose);
|
|
14857
|
-
// five.on('wantsGesture', handleRerender)
|
|
14858
|
-
// five.on('gesture', rerender)
|
|
14859
|
-
five.on('wantsMouseWheel', handleRerender);
|
|
14860
|
-
five.on('mouseWheel', rerender);
|
|
14861
|
-
five.on('wantsInteriaPan', handleRerender);
|
|
14862
|
-
five.on('interiaPan', handleInteriaPanRerender);
|
|
14863
|
-
five.on('wantsPanGesture', handleWantsPanGesture);
|
|
14864
|
-
five.on('panGesture', handlePanGesture);
|
|
14865
|
-
five.on('wantsPinchGesture', handleRerender);
|
|
14866
|
-
five.on('pinchGesture', rerender);
|
|
14867
14850
|
};
|
|
14868
14851
|
// 取消 five 监听
|
|
14869
14852
|
const removeListener4Five = () => {
|
|
14870
14853
|
five.off('modeChange', onFiveModeChange);
|
|
14871
|
-
// five.off('wantsGesture', handleRerender)
|
|
14872
|
-
// five.off('gesture', rerender)
|
|
14873
|
-
five.off('wantsMouseWheel', handleRerender);
|
|
14874
|
-
five.off('mouseWheel', rerender);
|
|
14875
|
-
five.off('wantsInteriaPan', handleRerender);
|
|
14876
|
-
five.off('interiaPan', handleInteriaPanRerender);
|
|
14877
|
-
five.off('wantsPanGesture', handleWantsPanGesture);
|
|
14878
|
-
five.off('panGesture', handlePanGesture);
|
|
14879
|
-
five.off('wantsPinchGesture', handleRerender);
|
|
14880
|
-
five.off('pinchGesture', rerender);
|
|
14881
14854
|
};
|
|
14882
14855
|
const onFiveModeChange = (mode) => {
|
|
14883
|
-
if (!pluginState.enabled
|
|
14856
|
+
if (!pluginState.enabled)
|
|
14884
14857
|
return;
|
|
14885
14858
|
if (mode !== Five.Mode.Floorplan) {
|
|
14886
14859
|
pluginState.fiveModeEnabled = false;
|