@realsee/dnalogel 2.0.0-alpha.30 → 2.0.0-alpha.31-beta
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/ItemLabelPlugin/index.js +61 -42
- package/dist/index.es.js +58 -39
- package/dist/index.js +61 -42
- package/dist/index.umd.js +61 -42
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- 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 +1 -1
- package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
- package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/FloorplanBounding.html +4 -4
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +7 -7
- package/docs/interfaces/FloorplanExtraObject.html +3 -3
- 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 +6 -6
- package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
- package/docs/interfaces/FloorplanServerBounding.html +4 -4
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerEntrance.html +7 -7
- 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 +7 -7
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
- 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 +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/ModelViewPluginExportType.html +1 -1
- package/docs/interfaces/OpenParameter.html +2 -2
- 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 -1
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/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 +9 -9
- package/docs/modules.html +20 -20
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +51 -32
- package/libs/ItemLabelPlugin/ItemLabelItem.js +5 -6
- package/libs/ItemLabelPlugin/utils/isImpacted.js +2 -1
- package/package.json +2 -2
|
@@ -58,7 +58,7 @@ function create_if_block$1(ctx) {
|
|
|
58
58
|
div1 = internal.element("div");
|
|
59
59
|
div0 = internal.element("div");
|
|
60
60
|
internal.attr(div0, "class", "icon svelte-4rvov0");
|
|
61
|
-
internal.attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon
|
|
61
|
+
internal.attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`);
|
|
62
62
|
internal.attr(div1, "class", "icon-wrap svelte-4rvov0");
|
|
63
63
|
},
|
|
64
64
|
m(target, anchor) {
|
|
@@ -71,7 +71,7 @@ function create_if_block$1(ctx) {
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
p(ctx, dirty) {
|
|
74
|
-
if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon
|
|
74
|
+
if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`)) {
|
|
75
75
|
internal.attr(div0, "style", div0_style_value);
|
|
76
76
|
}
|
|
77
77
|
},
|
|
@@ -89,7 +89,7 @@ function create_fragment$1(ctx) {
|
|
|
89
89
|
let t0;
|
|
90
90
|
let div0;
|
|
91
91
|
let span0;
|
|
92
|
-
let t1_value = (/*itemLabel*/ ctx[0].code
|
|
92
|
+
let t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "";
|
|
93
93
|
let t1;
|
|
94
94
|
let t2;
|
|
95
95
|
let span1;
|
|
@@ -161,7 +161,7 @@ function create_fragment$1(ctx) {
|
|
|
161
161
|
if_block = null;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code
|
|
164
|
+
if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "")) internal.set_data(t1, t1_value);
|
|
165
165
|
if (dirty & /*itemLabel*/ 1 && t3_value !== (t3_value = /*itemLabel*/ ctx[0].name + "")) internal.set_data(t3, t3_value);
|
|
166
166
|
|
|
167
167
|
if (dirty & /*itemLabel*/ 1) {
|
|
@@ -199,14 +199,13 @@ function create_fragment$1(ctx) {
|
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n';
|
|
203
|
-
|
|
204
202
|
function instance$1($$self, $$props, $$invalidate) {
|
|
205
203
|
let { itemLabel } = $$props;
|
|
206
204
|
let { hooks } = $$props;
|
|
207
205
|
let { anchorEnabled } = $$props;
|
|
208
206
|
let { onIconClick } = $$props;
|
|
209
207
|
|
|
208
|
+
// const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n'
|
|
210
209
|
function onClick() {
|
|
211
210
|
hooks.emit('onLabelClick', itemLabel);
|
|
212
211
|
}
|
|
@@ -268,7 +267,8 @@ const isImpacted = (five, sourceVector, targetVector, distance) => {
|
|
|
268
267
|
const raycaster = new Raycaster();
|
|
269
268
|
raycaster.set(targetVector, direction);
|
|
270
269
|
const [intersection] = five.model.intersectRaycaster(raycaster);
|
|
271
|
-
return intersection &&
|
|
270
|
+
return intersection && intersection.distance + 0.01 < distance;
|
|
271
|
+
// return intersection && distance <= intersection.distance + 0.1
|
|
272
272
|
};
|
|
273
273
|
|
|
274
274
|
/**
|
|
@@ -304,18 +304,18 @@ function add_css(target) {
|
|
|
304
304
|
|
|
305
305
|
function get_each_context(ctx, list, i) {
|
|
306
306
|
const child_ctx = ctx.slice();
|
|
307
|
-
child_ctx[
|
|
307
|
+
child_ctx[32] = list[i];
|
|
308
308
|
return child_ctx;
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
// (
|
|
311
|
+
// (248:2) {#if itemLabelItem.visible}
|
|
312
312
|
function create_if_block(ctx) {
|
|
313
313
|
let itemlabelitem;
|
|
314
314
|
let current;
|
|
315
315
|
|
|
316
316
|
itemlabelitem = new ItemLabelItem({
|
|
317
317
|
props: {
|
|
318
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
318
|
+
itemLabel: /*itemLabelItem*/ ctx[32],
|
|
319
319
|
hooks: /*hooks*/ ctx[0],
|
|
320
320
|
anchorEnabled: /*anchorEnabled*/ ctx[2],
|
|
321
321
|
onIconClick: /*onIconClick*/ ctx[6]
|
|
@@ -332,7 +332,7 @@ function create_if_block(ctx) {
|
|
|
332
332
|
},
|
|
333
333
|
p(ctx, dirty) {
|
|
334
334
|
const itemlabelitem_changes = {};
|
|
335
|
-
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[
|
|
335
|
+
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[32];
|
|
336
336
|
if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
337
337
|
if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
|
|
338
338
|
itemlabelitem.$set(itemlabelitem_changes);
|
|
@@ -352,12 +352,12 @@ function create_if_block(ctx) {
|
|
|
352
352
|
};
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
// (
|
|
355
|
+
// (247:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
356
356
|
function create_each_block(key_1, ctx) {
|
|
357
357
|
let first;
|
|
358
358
|
let if_block_anchor;
|
|
359
359
|
let current;
|
|
360
|
-
let if_block = /*itemLabelItem*/ ctx[
|
|
360
|
+
let if_block = /*itemLabelItem*/ ctx[32].visible && create_if_block(ctx);
|
|
361
361
|
|
|
362
362
|
return {
|
|
363
363
|
key: key_1,
|
|
@@ -377,7 +377,7 @@ function create_each_block(key_1, ctx) {
|
|
|
377
377
|
p(new_ctx, dirty) {
|
|
378
378
|
ctx = new_ctx;
|
|
379
379
|
|
|
380
|
-
if (/*itemLabelItem*/ ctx[
|
|
380
|
+
if (/*itemLabelItem*/ ctx[32].visible) {
|
|
381
381
|
if (if_block) {
|
|
382
382
|
if_block.p(ctx, dirty);
|
|
383
383
|
|
|
@@ -424,7 +424,7 @@ function create_fragment(ctx) {
|
|
|
424
424
|
let div_resize_listener;
|
|
425
425
|
let current;
|
|
426
426
|
let each_value = /*renderItemLabels*/ ctx[1];
|
|
427
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
427
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[32].id;
|
|
428
428
|
|
|
429
429
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
430
430
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -526,7 +526,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
526
526
|
* 1、当前楼层(假设先不考虑多楼层)
|
|
527
527
|
* 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
|
|
528
528
|
* */
|
|
529
|
-
const
|
|
529
|
+
const judgeImpacted = (five$1, itemLabel) => {
|
|
530
530
|
// 虚拟 VR 仅有一层,不考虑楼层信息
|
|
531
531
|
const cameraPosition = five$1.camera.position.clone();
|
|
532
532
|
|
|
@@ -547,6 +547,17 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
547
547
|
// const [intersection] = five.model.intersectRaycaster(raycaster)
|
|
548
548
|
// return !(intersection && intersection.distance + 1 < vectorDistance);
|
|
549
549
|
|
|
550
|
+
const judgeInViewport = modelPoint => {
|
|
551
|
+
const { camera, model } = five$1;
|
|
552
|
+
const { x: offsetXFromCenter, y: offsetYFromCenter, z: offsetZFromCenter } = modelPoint.clone().project(camera);
|
|
553
|
+
const ratioFromLeft = (offsetXFromCenter + 1) / 2;
|
|
554
|
+
const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
|
|
555
|
+
const isFront = Math.abs(offsetZFromCenter) < 1;
|
|
556
|
+
const cssOffset = [ratioFromLeft, ratioFromTop];
|
|
557
|
+
const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
|
|
558
|
+
return Boolean(isInViewport);
|
|
559
|
+
};
|
|
560
|
+
|
|
550
561
|
// cssOffset 获取
|
|
551
562
|
const getLabelCssOffset = (five, itemLabel) => {
|
|
552
563
|
const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
|
|
@@ -563,19 +574,26 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
563
574
|
return [xOffset, yOffset];
|
|
564
575
|
};
|
|
565
576
|
|
|
566
|
-
const getFormatedItemLabels = (five, labels) => {
|
|
577
|
+
const getFormatedItemLabels = (five$1, labels) => {
|
|
567
578
|
// 计算位置 & 可见性
|
|
568
579
|
const newLabels = labels.map(label => {
|
|
569
|
-
const cssOffset = getLabelCssOffset(five, label);
|
|
580
|
+
const cssOffset = getLabelCssOffset(five$1, label);
|
|
570
581
|
label.name.length * basicWidth;
|
|
571
582
|
const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
|
|
572
583
|
|
|
573
584
|
// 是否加入碰撞检测
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
585
|
+
// 配置加入碰撞检测,则判断碰撞检测
|
|
586
|
+
// 在可见范围内, 仅在 Panorama 模态计算
|
|
587
|
+
const isInViewport = five$1.currentMode === five.Five.Mode.Panorama
|
|
588
|
+
? judgeInViewport(new Vector3(label.position[0], label.position[1], label.position[2]))
|
|
589
|
+
: true;
|
|
577
590
|
|
|
578
|
-
|
|
591
|
+
// 碰撞
|
|
592
|
+
const isBlocked = modelOcclusionEnable
|
|
593
|
+
? judgeImpacted(five$1, label)
|
|
594
|
+
: false;
|
|
595
|
+
|
|
596
|
+
const visible = isInViewport && !isBlocked;
|
|
579
597
|
|
|
580
598
|
// 关掉重叠计算
|
|
581
599
|
// const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth)
|
|
@@ -591,7 +609,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
591
609
|
|
|
592
610
|
const sortedItemLabelItems = newLabels.filter(({ visible }) => visible).map(label => ({
|
|
593
611
|
itemLabelItem: label,
|
|
594
|
-
distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five.camera.position)
|
|
612
|
+
distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five$1.camera.position)
|
|
595
613
|
})).sort((a, b) => a.distance - b.distance);
|
|
596
614
|
|
|
597
615
|
return newLabels.map(label => {
|
|
@@ -606,24 +624,11 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
606
624
|
$$invalidate(1, renderItemLabels = getFormatedItemLabels(five$1, renderItemLabels));
|
|
607
625
|
};
|
|
608
626
|
|
|
609
|
-
svelte.beforeUpdate(() => {
|
|
610
|
-
addDataUpdateListener();
|
|
611
|
-
});
|
|
612
|
-
|
|
613
627
|
const handleCameraUpdateCallback = () => {
|
|
614
628
|
$$invalidate(5, itemsVisible = false);
|
|
615
629
|
handleCameraUpdate();
|
|
616
630
|
};
|
|
617
631
|
|
|
618
|
-
svelte.onMount(() => {
|
|
619
|
-
$$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
|
|
620
|
-
curItemLabels = itemLabels;
|
|
621
|
-
onItemLabelUpdate();
|
|
622
|
-
addResizeListener();
|
|
623
|
-
five$1.on('cameraUpdate', handleCameraUpdateCallback);
|
|
624
|
-
five$1.on('modeChange', onFiveModeChange);
|
|
625
|
-
});
|
|
626
|
-
|
|
627
632
|
const onFiveModeChange = mode => {
|
|
628
633
|
$$invalidate(5, itemsVisible = false);
|
|
629
634
|
|
|
@@ -671,12 +676,6 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
671
676
|
}
|
|
672
677
|
});
|
|
673
678
|
|
|
674
|
-
svelte.onDestroy(() => {
|
|
675
|
-
five$1.off('cameraUpdate', handleCameraUpdateCallback);
|
|
676
|
-
five$1.off('modeChange', onFiveModeChange);
|
|
677
|
-
resizeObserver.unobserve(wrapper);
|
|
678
|
-
});
|
|
679
|
-
|
|
680
679
|
const getNearObserverPano = (fromPositionVector, observers) => {
|
|
681
680
|
let candidates = [];
|
|
682
681
|
|
|
@@ -714,6 +713,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
714
713
|
const observer = getNearObserverPano(fromPositionVector, observers);
|
|
715
714
|
|
|
716
715
|
if (observer) {
|
|
716
|
+
console.log('--has observer--');
|
|
717
717
|
itemLabel.observerIndex = observer.panoIndex;
|
|
718
718
|
}
|
|
719
719
|
|
|
@@ -746,6 +746,25 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
746
746
|
}
|
|
747
747
|
};
|
|
748
748
|
|
|
749
|
+
svelte.beforeUpdate(() => {
|
|
750
|
+
addDataUpdateListener();
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
svelte.onMount(() => {
|
|
754
|
+
$$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
|
|
755
|
+
curItemLabels = itemLabels;
|
|
756
|
+
onItemLabelUpdate();
|
|
757
|
+
addResizeListener();
|
|
758
|
+
five$1.on('cameraUpdate', handleCameraUpdateCallback);
|
|
759
|
+
five$1.on('modeChange', onFiveModeChange);
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
svelte.onDestroy(() => {
|
|
763
|
+
five$1.off('cameraUpdate', handleCameraUpdateCallback);
|
|
764
|
+
five$1.off('modeChange', onFiveModeChange);
|
|
765
|
+
resizeObserver.unobserve(wrapper);
|
|
766
|
+
});
|
|
767
|
+
|
|
749
768
|
function div_elementresize_handler() {
|
|
750
769
|
containerWidth = this.clientWidth;
|
|
751
770
|
containerHeight = this.clientHeight;
|
package/dist/index.es.js
CHANGED
|
@@ -13765,7 +13765,7 @@ function create_if_block$1(ctx) {
|
|
|
13765
13765
|
div1 = element("div");
|
|
13766
13766
|
div0 = element("div");
|
|
13767
13767
|
attr(div0, "class", "icon svelte-4rvov0");
|
|
13768
|
-
attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon
|
|
13768
|
+
attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`);
|
|
13769
13769
|
attr(div1, "class", "icon-wrap svelte-4rvov0");
|
|
13770
13770
|
},
|
|
13771
13771
|
m(target, anchor) {
|
|
@@ -13778,7 +13778,7 @@ function create_if_block$1(ctx) {
|
|
|
13778
13778
|
}
|
|
13779
13779
|
},
|
|
13780
13780
|
p(ctx, dirty) {
|
|
13781
|
-
if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon
|
|
13781
|
+
if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`)) {
|
|
13782
13782
|
attr(div0, "style", div0_style_value);
|
|
13783
13783
|
}
|
|
13784
13784
|
},
|
|
@@ -13796,7 +13796,7 @@ function create_fragment$1(ctx) {
|
|
|
13796
13796
|
let t0;
|
|
13797
13797
|
let div0;
|
|
13798
13798
|
let span0;
|
|
13799
|
-
let t1_value = (/*itemLabel*/ ctx[0].code
|
|
13799
|
+
let t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "";
|
|
13800
13800
|
let t1;
|
|
13801
13801
|
let t2;
|
|
13802
13802
|
let span1;
|
|
@@ -13868,7 +13868,7 @@ function create_fragment$1(ctx) {
|
|
|
13868
13868
|
if_block = null;
|
|
13869
13869
|
}
|
|
13870
13870
|
|
|
13871
|
-
if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code
|
|
13871
|
+
if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "")) set_data(t1, t1_value);
|
|
13872
13872
|
if (dirty & /*itemLabel*/ 1 && t3_value !== (t3_value = /*itemLabel*/ ctx[0].name + "")) set_data(t3, t3_value);
|
|
13873
13873
|
|
|
13874
13874
|
if (dirty & /*itemLabel*/ 1) {
|
|
@@ -13906,14 +13906,13 @@ function create_fragment$1(ctx) {
|
|
|
13906
13906
|
};
|
|
13907
13907
|
}
|
|
13908
13908
|
|
|
13909
|
-
const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n';
|
|
13910
|
-
|
|
13911
13909
|
function instance$1($$self, $$props, $$invalidate) {
|
|
13912
13910
|
let { itemLabel } = $$props;
|
|
13913
13911
|
let { hooks } = $$props;
|
|
13914
13912
|
let { anchorEnabled } = $$props;
|
|
13915
13913
|
let { onIconClick } = $$props;
|
|
13916
13914
|
|
|
13915
|
+
// const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n'
|
|
13917
13916
|
function onClick() {
|
|
13918
13917
|
hooks.emit('onLabelClick', itemLabel);
|
|
13919
13918
|
}
|
|
@@ -13960,7 +13959,8 @@ const isImpacted = (five, sourceVector, targetVector, distance) => {
|
|
|
13960
13959
|
const raycaster = new Raycaster();
|
|
13961
13960
|
raycaster.set(targetVector, direction);
|
|
13962
13961
|
const [intersection] = five.model.intersectRaycaster(raycaster);
|
|
13963
|
-
return intersection &&
|
|
13962
|
+
return intersection && intersection.distance + 0.01 < distance;
|
|
13963
|
+
// return intersection && distance <= intersection.distance + 0.1
|
|
13964
13964
|
};
|
|
13965
13965
|
|
|
13966
13966
|
/**
|
|
@@ -13996,18 +13996,18 @@ function add_css(target) {
|
|
|
13996
13996
|
|
|
13997
13997
|
function get_each_context(ctx, list, i) {
|
|
13998
13998
|
const child_ctx = ctx.slice();
|
|
13999
|
-
child_ctx[
|
|
13999
|
+
child_ctx[32] = list[i];
|
|
14000
14000
|
return child_ctx;
|
|
14001
14001
|
}
|
|
14002
14002
|
|
|
14003
|
-
// (
|
|
14003
|
+
// (248:2) {#if itemLabelItem.visible}
|
|
14004
14004
|
function create_if_block(ctx) {
|
|
14005
14005
|
let itemlabelitem;
|
|
14006
14006
|
let current;
|
|
14007
14007
|
|
|
14008
14008
|
itemlabelitem = new ItemLabelItem({
|
|
14009
14009
|
props: {
|
|
14010
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
14010
|
+
itemLabel: /*itemLabelItem*/ ctx[32],
|
|
14011
14011
|
hooks: /*hooks*/ ctx[0],
|
|
14012
14012
|
anchorEnabled: /*anchorEnabled*/ ctx[2],
|
|
14013
14013
|
onIconClick: /*onIconClick*/ ctx[6]
|
|
@@ -14024,7 +14024,7 @@ function create_if_block(ctx) {
|
|
|
14024
14024
|
},
|
|
14025
14025
|
p(ctx, dirty) {
|
|
14026
14026
|
const itemlabelitem_changes = {};
|
|
14027
|
-
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[
|
|
14027
|
+
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[32];
|
|
14028
14028
|
if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
14029
14029
|
if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
|
|
14030
14030
|
itemlabelitem.$set(itemlabelitem_changes);
|
|
@@ -14044,12 +14044,12 @@ function create_if_block(ctx) {
|
|
|
14044
14044
|
};
|
|
14045
14045
|
}
|
|
14046
14046
|
|
|
14047
|
-
// (
|
|
14047
|
+
// (247:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
14048
14048
|
function create_each_block(key_1, ctx) {
|
|
14049
14049
|
let first;
|
|
14050
14050
|
let if_block_anchor;
|
|
14051
14051
|
let current;
|
|
14052
|
-
let if_block = /*itemLabelItem*/ ctx[
|
|
14052
|
+
let if_block = /*itemLabelItem*/ ctx[32].visible && create_if_block(ctx);
|
|
14053
14053
|
|
|
14054
14054
|
return {
|
|
14055
14055
|
key: key_1,
|
|
@@ -14069,7 +14069,7 @@ function create_each_block(key_1, ctx) {
|
|
|
14069
14069
|
p(new_ctx, dirty) {
|
|
14070
14070
|
ctx = new_ctx;
|
|
14071
14071
|
|
|
14072
|
-
if (/*itemLabelItem*/ ctx[
|
|
14072
|
+
if (/*itemLabelItem*/ ctx[32].visible) {
|
|
14073
14073
|
if (if_block) {
|
|
14074
14074
|
if_block.p(ctx, dirty);
|
|
14075
14075
|
|
|
@@ -14116,7 +14116,7 @@ function create_fragment(ctx) {
|
|
|
14116
14116
|
let div_resize_listener;
|
|
14117
14117
|
let current;
|
|
14118
14118
|
let each_value = /*renderItemLabels*/ ctx[1];
|
|
14119
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
14119
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[32].id;
|
|
14120
14120
|
|
|
14121
14121
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
14122
14122
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -14218,7 +14218,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14218
14218
|
* 1、当前楼层(假设先不考虑多楼层)
|
|
14219
14219
|
* 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
|
|
14220
14220
|
* */
|
|
14221
|
-
const
|
|
14221
|
+
const judgeImpacted = (five, itemLabel) => {
|
|
14222
14222
|
// 虚拟 VR 仅有一层,不考虑楼层信息
|
|
14223
14223
|
const cameraPosition = five.camera.position.clone();
|
|
14224
14224
|
|
|
@@ -14239,6 +14239,17 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14239
14239
|
// const [intersection] = five.model.intersectRaycaster(raycaster)
|
|
14240
14240
|
// return !(intersection && intersection.distance + 1 < vectorDistance);
|
|
14241
14241
|
|
|
14242
|
+
const judgeInViewport = modelPoint => {
|
|
14243
|
+
const { camera, model } = five;
|
|
14244
|
+
const { x: offsetXFromCenter, y: offsetYFromCenter, z: offsetZFromCenter } = modelPoint.clone().project(camera);
|
|
14245
|
+
const ratioFromLeft = (offsetXFromCenter + 1) / 2;
|
|
14246
|
+
const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
|
|
14247
|
+
const isFront = Math.abs(offsetZFromCenter) < 1;
|
|
14248
|
+
const cssOffset = [ratioFromLeft, ratioFromTop];
|
|
14249
|
+
const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
|
|
14250
|
+
return Boolean(isInViewport);
|
|
14251
|
+
};
|
|
14252
|
+
|
|
14242
14253
|
// cssOffset 获取
|
|
14243
14254
|
const getLabelCssOffset = (five, itemLabel) => {
|
|
14244
14255
|
const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
|
|
@@ -14263,11 +14274,18 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14263
14274
|
const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
|
|
14264
14275
|
|
|
14265
14276
|
// 是否加入碰撞检测
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14277
|
+
// 配置加入碰撞检测,则判断碰撞检测
|
|
14278
|
+
// 在可见范围内, 仅在 Panorama 模态计算
|
|
14279
|
+
const isInViewport = five.currentMode === Five.Mode.Panorama
|
|
14280
|
+
? judgeInViewport(new Vector3(label.position[0], label.position[1], label.position[2]))
|
|
14281
|
+
: true;
|
|
14282
|
+
|
|
14283
|
+
// 碰撞
|
|
14284
|
+
const isBlocked = modelOcclusionEnable
|
|
14285
|
+
? judgeImpacted(five, label)
|
|
14286
|
+
: false;
|
|
14269
14287
|
|
|
14270
|
-
const visible =
|
|
14288
|
+
const visible = isInViewport && !isBlocked;
|
|
14271
14289
|
|
|
14272
14290
|
// 关掉重叠计算
|
|
14273
14291
|
// const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth)
|
|
@@ -14298,24 +14316,11 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14298
14316
|
$$invalidate(1, renderItemLabels = getFormatedItemLabels(five, renderItemLabels));
|
|
14299
14317
|
};
|
|
14300
14318
|
|
|
14301
|
-
beforeUpdate(() => {
|
|
14302
|
-
addDataUpdateListener();
|
|
14303
|
-
});
|
|
14304
|
-
|
|
14305
14319
|
const handleCameraUpdateCallback = () => {
|
|
14306
14320
|
$$invalidate(5, itemsVisible = false);
|
|
14307
14321
|
handleCameraUpdate();
|
|
14308
14322
|
};
|
|
14309
14323
|
|
|
14310
|
-
onMount(() => {
|
|
14311
|
-
$$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
|
|
14312
|
-
curItemLabels = itemLabels;
|
|
14313
|
-
onItemLabelUpdate();
|
|
14314
|
-
addResizeListener();
|
|
14315
|
-
five.on('cameraUpdate', handleCameraUpdateCallback);
|
|
14316
|
-
five.on('modeChange', onFiveModeChange);
|
|
14317
|
-
});
|
|
14318
|
-
|
|
14319
14324
|
const onFiveModeChange = mode => {
|
|
14320
14325
|
$$invalidate(5, itemsVisible = false);
|
|
14321
14326
|
|
|
@@ -14363,12 +14368,6 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14363
14368
|
}
|
|
14364
14369
|
});
|
|
14365
14370
|
|
|
14366
|
-
onDestroy(() => {
|
|
14367
|
-
five.off('cameraUpdate', handleCameraUpdateCallback);
|
|
14368
|
-
five.off('modeChange', onFiveModeChange);
|
|
14369
|
-
resizeObserver.unobserve(wrapper);
|
|
14370
|
-
});
|
|
14371
|
-
|
|
14372
14371
|
const getNearObserverPano = (fromPositionVector, observers) => {
|
|
14373
14372
|
let candidates = [];
|
|
14374
14373
|
|
|
@@ -14406,6 +14405,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14406
14405
|
const observer = getNearObserverPano(fromPositionVector, observers);
|
|
14407
14406
|
|
|
14408
14407
|
if (observer) {
|
|
14408
|
+
console.log('--has observer--');
|
|
14409
14409
|
itemLabel.observerIndex = observer.panoIndex;
|
|
14410
14410
|
}
|
|
14411
14411
|
|
|
@@ -14438,6 +14438,25 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14438
14438
|
}
|
|
14439
14439
|
};
|
|
14440
14440
|
|
|
14441
|
+
beforeUpdate(() => {
|
|
14442
|
+
addDataUpdateListener();
|
|
14443
|
+
});
|
|
14444
|
+
|
|
14445
|
+
onMount(() => {
|
|
14446
|
+
$$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
|
|
14447
|
+
curItemLabels = itemLabels;
|
|
14448
|
+
onItemLabelUpdate();
|
|
14449
|
+
addResizeListener();
|
|
14450
|
+
five.on('cameraUpdate', handleCameraUpdateCallback);
|
|
14451
|
+
five.on('modeChange', onFiveModeChange);
|
|
14452
|
+
});
|
|
14453
|
+
|
|
14454
|
+
onDestroy(() => {
|
|
14455
|
+
five.off('cameraUpdate', handleCameraUpdateCallback);
|
|
14456
|
+
five.off('modeChange', onFiveModeChange);
|
|
14457
|
+
resizeObserver.unobserve(wrapper);
|
|
14458
|
+
});
|
|
14459
|
+
|
|
14441
14460
|
function div_elementresize_handler() {
|
|
14442
14461
|
containerWidth = this.clientWidth;
|
|
14443
14462
|
containerHeight = this.clientHeight;
|