@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/dist/index.js
CHANGED
|
@@ -14392,6 +14392,21 @@ class ItemLabelItem extends internal.SvelteComponent {
|
|
|
14392
14392
|
}
|
|
14393
14393
|
}
|
|
14394
14394
|
|
|
14395
|
+
/**
|
|
14396
|
+
* 创建一个防抖动函数,该函数会在 wait 毫秒后调用 func 方法
|
|
14397
|
+
* @param func - 要防抖动的函数
|
|
14398
|
+
* @param [wait=0] - 需要延迟的毫秒数
|
|
14399
|
+
*/
|
|
14400
|
+
function debounce(func, wait = 200) {
|
|
14401
|
+
let last;
|
|
14402
|
+
return function (...args) {
|
|
14403
|
+
clearTimeout(last);
|
|
14404
|
+
last = setTimeout(() => {
|
|
14405
|
+
func(...args);
|
|
14406
|
+
}, wait);
|
|
14407
|
+
};
|
|
14408
|
+
}
|
|
14409
|
+
|
|
14395
14410
|
/* src/ModelItemLabelPlugin/ItemLabelComponent.svelte generated by Svelte v3.47.0 */
|
|
14396
14411
|
|
|
14397
14412
|
function add_css(target) {
|
|
@@ -14400,11 +14415,11 @@ function add_css(target) {
|
|
|
14400
14415
|
|
|
14401
14416
|
function get_each_context(ctx, list, i) {
|
|
14402
14417
|
const child_ctx = ctx.slice();
|
|
14403
|
-
child_ctx[
|
|
14418
|
+
child_ctx[27] = list[i];
|
|
14404
14419
|
return child_ctx;
|
|
14405
14420
|
}
|
|
14406
14421
|
|
|
14407
|
-
// (
|
|
14422
|
+
// (159:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
14408
14423
|
function create_each_block(key_1, ctx) {
|
|
14409
14424
|
let first;
|
|
14410
14425
|
let itemlabelitem;
|
|
@@ -14412,7 +14427,7 @@ function create_each_block(key_1, ctx) {
|
|
|
14412
14427
|
|
|
14413
14428
|
itemlabelitem = new ItemLabelItem({
|
|
14414
14429
|
props: {
|
|
14415
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
14430
|
+
itemLabel: /*itemLabelItem*/ ctx[27],
|
|
14416
14431
|
hooks: /*hooks*/ ctx[0]
|
|
14417
14432
|
}
|
|
14418
14433
|
});
|
|
@@ -14433,7 +14448,7 @@ function create_each_block(key_1, ctx) {
|
|
|
14433
14448
|
p(new_ctx, dirty) {
|
|
14434
14449
|
ctx = new_ctx;
|
|
14435
14450
|
const itemlabelitem_changes = {};
|
|
14436
|
-
if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[
|
|
14451
|
+
if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[27];
|
|
14437
14452
|
if (dirty & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
14438
14453
|
itemlabelitem.$set(itemlabelitem_changes);
|
|
14439
14454
|
},
|
|
@@ -14460,7 +14475,7 @@ function create_fragment(ctx) {
|
|
|
14460
14475
|
let div_resize_listener;
|
|
14461
14476
|
let current;
|
|
14462
14477
|
let each_value = /*renderItemLabels*/ ctx[1];
|
|
14463
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
14478
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[27].id;
|
|
14464
14479
|
|
|
14465
14480
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
14466
14481
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -14477,7 +14492,8 @@ function create_fragment(ctx) {
|
|
|
14477
14492
|
}
|
|
14478
14493
|
|
|
14479
14494
|
internal.attr(div, "class", "item-labels-container svelte-rmdeb");
|
|
14480
|
-
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[
|
|
14495
|
+
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[10].call(div));
|
|
14496
|
+
internal.set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
|
|
14481
14497
|
},
|
|
14482
14498
|
m(target, anchor) {
|
|
14483
14499
|
internal.insert(target, div, anchor);
|
|
@@ -14486,7 +14502,7 @@ function create_fragment(ctx) {
|
|
|
14486
14502
|
each_blocks[i].m(div, null);
|
|
14487
14503
|
}
|
|
14488
14504
|
|
|
14489
|
-
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[
|
|
14505
|
+
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[10].bind(div));
|
|
14490
14506
|
current = true;
|
|
14491
14507
|
},
|
|
14492
14508
|
p(ctx, [dirty]) {
|
|
@@ -14496,6 +14512,10 @@ function create_fragment(ctx) {
|
|
|
14496
14512
|
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);
|
|
14497
14513
|
internal.check_outros();
|
|
14498
14514
|
}
|
|
14515
|
+
|
|
14516
|
+
if (dirty & /*itemsVisible*/ 16) {
|
|
14517
|
+
internal.set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
|
|
14518
|
+
}
|
|
14499
14519
|
},
|
|
14500
14520
|
i(local) {
|
|
14501
14521
|
if (current) return;
|
|
@@ -14545,6 +14565,14 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14545
14565
|
// 计算重叠
|
|
14546
14566
|
let cssOffsetLists = [];
|
|
14547
14567
|
|
|
14568
|
+
// 动画过程中 itemsVisible 为 false
|
|
14569
|
+
let itemsVisible = true;
|
|
14570
|
+
|
|
14571
|
+
/**
|
|
14572
|
+
* 可见性策略:
|
|
14573
|
+
* 1、当前楼层(假设先不考虑多楼层)
|
|
14574
|
+
* 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
|
|
14575
|
+
* */
|
|
14548
14576
|
const getLabelVisible = (five, itemLabel) => {
|
|
14549
14577
|
// 虚拟 VR 仅有一层,不考虑楼层信息
|
|
14550
14578
|
const raycaster = new Raycaster();
|
|
@@ -14648,11 +14676,22 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14648
14676
|
$$invalidate(1, renderItemLabels = itemLabels);
|
|
14649
14677
|
curItemLabels = itemLabels;
|
|
14650
14678
|
onItemLabelUpdate();
|
|
14651
|
-
|
|
14652
|
-
// five.on('cameraUpdate', onItemLabelUpdate)
|
|
14653
14679
|
addResizeListener();
|
|
14680
|
+
|
|
14681
|
+
five.on('cameraUpdate', () => {
|
|
14682
|
+
$$invalidate(4, itemsVisible = false);
|
|
14683
|
+
handleCameraUpdate();
|
|
14684
|
+
});
|
|
14654
14685
|
});
|
|
14655
14686
|
|
|
14687
|
+
const handleCameraUpdate = debounce(
|
|
14688
|
+
() => {
|
|
14689
|
+
$$invalidate(4, itemsVisible = true);
|
|
14690
|
+
onItemLabelUpdate();
|
|
14691
|
+
},
|
|
14692
|
+
300
|
|
14693
|
+
);
|
|
14694
|
+
|
|
14656
14695
|
const addResizeListener = () => {
|
|
14657
14696
|
wrapperSize = {
|
|
14658
14697
|
width: wrapper.clientWidth,
|
|
@@ -14666,7 +14705,6 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14666
14705
|
if (curItemLabels !== itemLabels) {
|
|
14667
14706
|
$$invalidate(1, renderItemLabels = itemLabels);
|
|
14668
14707
|
curItemLabels = itemLabels;
|
|
14669
|
-
console.log('--debug--update--');
|
|
14670
14708
|
onItemLabelUpdate();
|
|
14671
14709
|
}
|
|
14672
14710
|
};
|
|
@@ -14684,9 +14722,8 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14684
14722
|
});
|
|
14685
14723
|
|
|
14686
14724
|
svelte.onDestroy(() => {
|
|
14687
|
-
|
|
14725
|
+
five.off('cameraUpdate');
|
|
14688
14726
|
resizeObserver.unobserve(wrapper);
|
|
14689
|
-
|
|
14690
14727
|
curItemLabels = null;
|
|
14691
14728
|
$$invalidate(1, renderItemLabels = null);
|
|
14692
14729
|
wrapperSize = { width: 0, height: 0 };
|
|
@@ -14700,12 +14737,12 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14700
14737
|
}
|
|
14701
14738
|
|
|
14702
14739
|
$$self.$$set = $$props => {
|
|
14703
|
-
if ('five' in $$props) $$invalidate(
|
|
14704
|
-
if ('modelOcclusionEnable' in $$props) $$invalidate(
|
|
14705
|
-
if ('itemLabels' in $$props) $$invalidate(
|
|
14706
|
-
if ('wrapper' in $$props) $$invalidate(
|
|
14740
|
+
if ('five' in $$props) $$invalidate(5, five = $$props.five);
|
|
14741
|
+
if ('modelOcclusionEnable' in $$props) $$invalidate(6, modelOcclusionEnable = $$props.modelOcclusionEnable);
|
|
14742
|
+
if ('itemLabels' in $$props) $$invalidate(7, itemLabels = $$props.itemLabels);
|
|
14743
|
+
if ('wrapper' in $$props) $$invalidate(8, wrapper = $$props.wrapper);
|
|
14707
14744
|
if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
|
|
14708
|
-
if ('displayStrategyType' in $$props) $$invalidate(
|
|
14745
|
+
if ('displayStrategyType' in $$props) $$invalidate(9, displayStrategyType = $$props.displayStrategyType);
|
|
14709
14746
|
};
|
|
14710
14747
|
|
|
14711
14748
|
return [
|
|
@@ -14713,6 +14750,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14713
14750
|
renderItemLabels,
|
|
14714
14751
|
containerWidth,
|
|
14715
14752
|
containerHeight,
|
|
14753
|
+
itemsVisible,
|
|
14716
14754
|
five,
|
|
14717
14755
|
modelOcclusionEnable,
|
|
14718
14756
|
itemLabels,
|
|
@@ -14733,12 +14771,12 @@ class ItemLabelComponent extends internal.SvelteComponent {
|
|
|
14733
14771
|
create_fragment,
|
|
14734
14772
|
internal.safe_not_equal,
|
|
14735
14773
|
{
|
|
14736
|
-
five:
|
|
14737
|
-
modelOcclusionEnable:
|
|
14738
|
-
itemLabels:
|
|
14739
|
-
wrapper:
|
|
14774
|
+
five: 5,
|
|
14775
|
+
modelOcclusionEnable: 6,
|
|
14776
|
+
itemLabels: 7,
|
|
14777
|
+
wrapper: 8,
|
|
14740
14778
|
hooks: 0,
|
|
14741
|
-
displayStrategyType:
|
|
14779
|
+
displayStrategyType: 9
|
|
14742
14780
|
},
|
|
14743
14781
|
add_css
|
|
14744
14782
|
);
|
|
@@ -14763,7 +14801,6 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
14763
14801
|
hooks: new five.Subscribe(),
|
|
14764
14802
|
modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
|
|
14765
14803
|
displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : DISPLAY_STRATEGY_TYPE.SMALL,
|
|
14766
|
-
pending: false
|
|
14767
14804
|
};
|
|
14768
14805
|
pluginState.container.setAttribute('class', 'model-item-label-plugin-container');
|
|
14769
14806
|
pluginState.container.style.cssText = `
|
|
@@ -14802,50 +14839,6 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
14802
14839
|
removeListener4Five();
|
|
14803
14840
|
pluginState.container.remove();
|
|
14804
14841
|
};
|
|
14805
|
-
const handleRerender = () => {
|
|
14806
|
-
if (!pluginState.enabled || !pluginState.fiveModeEnabled || pluginState.pending)
|
|
14807
|
-
return;
|
|
14808
|
-
pluginState.pending = true;
|
|
14809
|
-
disable();
|
|
14810
|
-
};
|
|
14811
|
-
const rerender = (a, b, c) => {
|
|
14812
|
-
if (!pluginState.pending)
|
|
14813
|
-
return;
|
|
14814
|
-
if (!pluginState.fiveModeEnabled)
|
|
14815
|
-
return;
|
|
14816
|
-
if (!c)
|
|
14817
|
-
return;
|
|
14818
|
-
pluginState.pending = false;
|
|
14819
|
-
enable();
|
|
14820
|
-
render();
|
|
14821
|
-
};
|
|
14822
|
-
const handleInteriaPanRerender = (a, b) => {
|
|
14823
|
-
if (!pluginState.pending)
|
|
14824
|
-
return;
|
|
14825
|
-
if (!pluginState.fiveModeEnabled)
|
|
14826
|
-
return;
|
|
14827
|
-
if (!b)
|
|
14828
|
-
return;
|
|
14829
|
-
pluginState.pending = false;
|
|
14830
|
-
enable();
|
|
14831
|
-
render();
|
|
14832
|
-
};
|
|
14833
|
-
const handleWantsPanGesture = (pose, final) => {
|
|
14834
|
-
if (pose) {
|
|
14835
|
-
handleRerender();
|
|
14836
|
-
}
|
|
14837
|
-
};
|
|
14838
|
-
const handlePanGesture = (pose, final) => {
|
|
14839
|
-
if (!pluginState.pending)
|
|
14840
|
-
return;
|
|
14841
|
-
if (!pluginState.fiveModeEnabled)
|
|
14842
|
-
return;
|
|
14843
|
-
if (!final)
|
|
14844
|
-
return;
|
|
14845
|
-
pluginState.pending = false;
|
|
14846
|
-
enable();
|
|
14847
|
-
render();
|
|
14848
|
-
};
|
|
14849
14842
|
const render = () => {
|
|
14850
14843
|
var _a;
|
|
14851
14844
|
if (!pluginState.wrapper)
|
|
@@ -14881,33 +14874,13 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
14881
14874
|
const addListener4Five = () => {
|
|
14882
14875
|
five$1.on('modeChange', onFiveModeChange);
|
|
14883
14876
|
five$1.once('dispose', dispose);
|
|
14884
|
-
// five.on('wantsGesture', handleRerender)
|
|
14885
|
-
// five.on('gesture', rerender)
|
|
14886
|
-
five$1.on('wantsMouseWheel', handleRerender);
|
|
14887
|
-
five$1.on('mouseWheel', rerender);
|
|
14888
|
-
five$1.on('wantsInteriaPan', handleRerender);
|
|
14889
|
-
five$1.on('interiaPan', handleInteriaPanRerender);
|
|
14890
|
-
five$1.on('wantsPanGesture', handleWantsPanGesture);
|
|
14891
|
-
five$1.on('panGesture', handlePanGesture);
|
|
14892
|
-
five$1.on('wantsPinchGesture', handleRerender);
|
|
14893
|
-
five$1.on('pinchGesture', rerender);
|
|
14894
14877
|
};
|
|
14895
14878
|
// 取消 five 监听
|
|
14896
14879
|
const removeListener4Five = () => {
|
|
14897
14880
|
five$1.off('modeChange', onFiveModeChange);
|
|
14898
|
-
// five.off('wantsGesture', handleRerender)
|
|
14899
|
-
// five.off('gesture', rerender)
|
|
14900
|
-
five$1.off('wantsMouseWheel', handleRerender);
|
|
14901
|
-
five$1.off('mouseWheel', rerender);
|
|
14902
|
-
five$1.off('wantsInteriaPan', handleRerender);
|
|
14903
|
-
five$1.off('interiaPan', handleInteriaPanRerender);
|
|
14904
|
-
five$1.off('wantsPanGesture', handleWantsPanGesture);
|
|
14905
|
-
five$1.off('panGesture', handlePanGesture);
|
|
14906
|
-
five$1.off('wantsPinchGesture', handleRerender);
|
|
14907
|
-
five$1.off('pinchGesture', rerender);
|
|
14908
14881
|
};
|
|
14909
14882
|
const onFiveModeChange = (mode) => {
|
|
14910
|
-
if (!pluginState.enabled
|
|
14883
|
+
if (!pluginState.enabled)
|
|
14911
14884
|
return;
|
|
14912
14885
|
if (mode !== five.Five.Mode.Floorplan) {
|
|
14913
14886
|
pluginState.fiveModeEnabled = false;
|
package/dist/index.umd.js
CHANGED
|
@@ -14381,6 +14381,21 @@
|
|
|
14381
14381
|
}
|
|
14382
14382
|
}
|
|
14383
14383
|
|
|
14384
|
+
/**
|
|
14385
|
+
* 创建一个防抖动函数,该函数会在 wait 毫秒后调用 func 方法
|
|
14386
|
+
* @param func - 要防抖动的函数
|
|
14387
|
+
* @param [wait=0] - 需要延迟的毫秒数
|
|
14388
|
+
*/
|
|
14389
|
+
function debounce(func, wait = 200) {
|
|
14390
|
+
let last;
|
|
14391
|
+
return function (...args) {
|
|
14392
|
+
clearTimeout(last);
|
|
14393
|
+
last = setTimeout(() => {
|
|
14394
|
+
func(...args);
|
|
14395
|
+
}, wait);
|
|
14396
|
+
};
|
|
14397
|
+
}
|
|
14398
|
+
|
|
14384
14399
|
/* src/ModelItemLabelPlugin/ItemLabelComponent.svelte generated by Svelte v3.47.0 */
|
|
14385
14400
|
|
|
14386
14401
|
function add_css(target) {
|
|
@@ -14389,11 +14404,11 @@
|
|
|
14389
14404
|
|
|
14390
14405
|
function get_each_context(ctx, list, i) {
|
|
14391
14406
|
const child_ctx = ctx.slice();
|
|
14392
|
-
child_ctx[
|
|
14407
|
+
child_ctx[27] = list[i];
|
|
14393
14408
|
return child_ctx;
|
|
14394
14409
|
}
|
|
14395
14410
|
|
|
14396
|
-
// (
|
|
14411
|
+
// (159:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
14397
14412
|
function create_each_block(key_1, ctx) {
|
|
14398
14413
|
let first;
|
|
14399
14414
|
let itemlabelitem;
|
|
@@ -14401,7 +14416,7 @@
|
|
|
14401
14416
|
|
|
14402
14417
|
itemlabelitem = new ItemLabelItem({
|
|
14403
14418
|
props: {
|
|
14404
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
14419
|
+
itemLabel: /*itemLabelItem*/ ctx[27],
|
|
14405
14420
|
hooks: /*hooks*/ ctx[0]
|
|
14406
14421
|
}
|
|
14407
14422
|
});
|
|
@@ -14422,7 +14437,7 @@
|
|
|
14422
14437
|
p(new_ctx, dirty) {
|
|
14423
14438
|
ctx = new_ctx;
|
|
14424
14439
|
const itemlabelitem_changes = {};
|
|
14425
|
-
if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[
|
|
14440
|
+
if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[27];
|
|
14426
14441
|
if (dirty & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
14427
14442
|
itemlabelitem.$set(itemlabelitem_changes);
|
|
14428
14443
|
},
|
|
@@ -14449,7 +14464,7 @@
|
|
|
14449
14464
|
let div_resize_listener;
|
|
14450
14465
|
let current;
|
|
14451
14466
|
let each_value = /*renderItemLabels*/ ctx[1];
|
|
14452
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
14467
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[27].id;
|
|
14453
14468
|
|
|
14454
14469
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
14455
14470
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -14466,7 +14481,8 @@
|
|
|
14466
14481
|
}
|
|
14467
14482
|
|
|
14468
14483
|
internal.attr(div, "class", "item-labels-container svelte-rmdeb");
|
|
14469
|
-
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[
|
|
14484
|
+
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[10].call(div));
|
|
14485
|
+
internal.set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
|
|
14470
14486
|
},
|
|
14471
14487
|
m(target, anchor) {
|
|
14472
14488
|
internal.insert(target, div, anchor);
|
|
@@ -14475,7 +14491,7 @@
|
|
|
14475
14491
|
each_blocks[i].m(div, null);
|
|
14476
14492
|
}
|
|
14477
14493
|
|
|
14478
|
-
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[
|
|
14494
|
+
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[10].bind(div));
|
|
14479
14495
|
current = true;
|
|
14480
14496
|
},
|
|
14481
14497
|
p(ctx, [dirty]) {
|
|
@@ -14485,6 +14501,10 @@
|
|
|
14485
14501
|
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);
|
|
14486
14502
|
internal.check_outros();
|
|
14487
14503
|
}
|
|
14504
|
+
|
|
14505
|
+
if (dirty & /*itemsVisible*/ 16) {
|
|
14506
|
+
internal.set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
|
|
14507
|
+
}
|
|
14488
14508
|
},
|
|
14489
14509
|
i(local) {
|
|
14490
14510
|
if (current) return;
|
|
@@ -14534,6 +14554,14 @@
|
|
|
14534
14554
|
// 计算重叠
|
|
14535
14555
|
let cssOffsetLists = [];
|
|
14536
14556
|
|
|
14557
|
+
// 动画过程中 itemsVisible 为 false
|
|
14558
|
+
let itemsVisible = true;
|
|
14559
|
+
|
|
14560
|
+
/**
|
|
14561
|
+
* 可见性策略:
|
|
14562
|
+
* 1、当前楼层(假设先不考虑多楼层)
|
|
14563
|
+
* 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
|
|
14564
|
+
* */
|
|
14537
14565
|
const getLabelVisible = (five, itemLabel) => {
|
|
14538
14566
|
// 虚拟 VR 仅有一层,不考虑楼层信息
|
|
14539
14567
|
const raycaster = new Raycaster();
|
|
@@ -14637,11 +14665,22 @@
|
|
|
14637
14665
|
$$invalidate(1, renderItemLabels = itemLabels);
|
|
14638
14666
|
curItemLabels = itemLabels;
|
|
14639
14667
|
onItemLabelUpdate();
|
|
14640
|
-
|
|
14641
|
-
// five.on('cameraUpdate', onItemLabelUpdate)
|
|
14642
14668
|
addResizeListener();
|
|
14669
|
+
|
|
14670
|
+
five.on('cameraUpdate', () => {
|
|
14671
|
+
$$invalidate(4, itemsVisible = false);
|
|
14672
|
+
handleCameraUpdate();
|
|
14673
|
+
});
|
|
14643
14674
|
});
|
|
14644
14675
|
|
|
14676
|
+
const handleCameraUpdate = debounce(
|
|
14677
|
+
() => {
|
|
14678
|
+
$$invalidate(4, itemsVisible = true);
|
|
14679
|
+
onItemLabelUpdate();
|
|
14680
|
+
},
|
|
14681
|
+
300
|
|
14682
|
+
);
|
|
14683
|
+
|
|
14645
14684
|
const addResizeListener = () => {
|
|
14646
14685
|
wrapperSize = {
|
|
14647
14686
|
width: wrapper.clientWidth,
|
|
@@ -14655,7 +14694,6 @@
|
|
|
14655
14694
|
if (curItemLabels !== itemLabels) {
|
|
14656
14695
|
$$invalidate(1, renderItemLabels = itemLabels);
|
|
14657
14696
|
curItemLabels = itemLabels;
|
|
14658
|
-
console.log('--debug--update--');
|
|
14659
14697
|
onItemLabelUpdate();
|
|
14660
14698
|
}
|
|
14661
14699
|
};
|
|
@@ -14673,9 +14711,8 @@
|
|
|
14673
14711
|
});
|
|
14674
14712
|
|
|
14675
14713
|
svelte.onDestroy(() => {
|
|
14676
|
-
|
|
14714
|
+
five.off('cameraUpdate');
|
|
14677
14715
|
resizeObserver.unobserve(wrapper);
|
|
14678
|
-
|
|
14679
14716
|
curItemLabels = null;
|
|
14680
14717
|
$$invalidate(1, renderItemLabels = null);
|
|
14681
14718
|
wrapperSize = { width: 0, height: 0 };
|
|
@@ -14689,12 +14726,12 @@
|
|
|
14689
14726
|
}
|
|
14690
14727
|
|
|
14691
14728
|
$$self.$$set = $$props => {
|
|
14692
|
-
if ('five' in $$props) $$invalidate(
|
|
14693
|
-
if ('modelOcclusionEnable' in $$props) $$invalidate(
|
|
14694
|
-
if ('itemLabels' in $$props) $$invalidate(
|
|
14695
|
-
if ('wrapper' in $$props) $$invalidate(
|
|
14729
|
+
if ('five' in $$props) $$invalidate(5, five = $$props.five);
|
|
14730
|
+
if ('modelOcclusionEnable' in $$props) $$invalidate(6, modelOcclusionEnable = $$props.modelOcclusionEnable);
|
|
14731
|
+
if ('itemLabels' in $$props) $$invalidate(7, itemLabels = $$props.itemLabels);
|
|
14732
|
+
if ('wrapper' in $$props) $$invalidate(8, wrapper = $$props.wrapper);
|
|
14696
14733
|
if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
|
|
14697
|
-
if ('displayStrategyType' in $$props) $$invalidate(
|
|
14734
|
+
if ('displayStrategyType' in $$props) $$invalidate(9, displayStrategyType = $$props.displayStrategyType);
|
|
14698
14735
|
};
|
|
14699
14736
|
|
|
14700
14737
|
return [
|
|
@@ -14702,6 +14739,7 @@
|
|
|
14702
14739
|
renderItemLabels,
|
|
14703
14740
|
containerWidth,
|
|
14704
14741
|
containerHeight,
|
|
14742
|
+
itemsVisible,
|
|
14705
14743
|
five,
|
|
14706
14744
|
modelOcclusionEnable,
|
|
14707
14745
|
itemLabels,
|
|
@@ -14722,12 +14760,12 @@
|
|
|
14722
14760
|
create_fragment,
|
|
14723
14761
|
internal.safe_not_equal,
|
|
14724
14762
|
{
|
|
14725
|
-
five:
|
|
14726
|
-
modelOcclusionEnable:
|
|
14727
|
-
itemLabels:
|
|
14728
|
-
wrapper:
|
|
14763
|
+
five: 5,
|
|
14764
|
+
modelOcclusionEnable: 6,
|
|
14765
|
+
itemLabels: 7,
|
|
14766
|
+
wrapper: 8,
|
|
14729
14767
|
hooks: 0,
|
|
14730
|
-
displayStrategyType:
|
|
14768
|
+
displayStrategyType: 9
|
|
14731
14769
|
},
|
|
14732
14770
|
add_css
|
|
14733
14771
|
);
|
|
@@ -14752,7 +14790,6 @@
|
|
|
14752
14790
|
hooks: new five.Subscribe(),
|
|
14753
14791
|
modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
|
|
14754
14792
|
displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : DISPLAY_STRATEGY_TYPE.SMALL,
|
|
14755
|
-
pending: false
|
|
14756
14793
|
};
|
|
14757
14794
|
pluginState.container.setAttribute('class', 'model-item-label-plugin-container');
|
|
14758
14795
|
pluginState.container.style.cssText = `
|
|
@@ -14791,50 +14828,6 @@
|
|
|
14791
14828
|
removeListener4Five();
|
|
14792
14829
|
pluginState.container.remove();
|
|
14793
14830
|
};
|
|
14794
|
-
const handleRerender = () => {
|
|
14795
|
-
if (!pluginState.enabled || !pluginState.fiveModeEnabled || pluginState.pending)
|
|
14796
|
-
return;
|
|
14797
|
-
pluginState.pending = true;
|
|
14798
|
-
disable();
|
|
14799
|
-
};
|
|
14800
|
-
const rerender = (a, b, c) => {
|
|
14801
|
-
if (!pluginState.pending)
|
|
14802
|
-
return;
|
|
14803
|
-
if (!pluginState.fiveModeEnabled)
|
|
14804
|
-
return;
|
|
14805
|
-
if (!c)
|
|
14806
|
-
return;
|
|
14807
|
-
pluginState.pending = false;
|
|
14808
|
-
enable();
|
|
14809
|
-
render();
|
|
14810
|
-
};
|
|
14811
|
-
const handleInteriaPanRerender = (a, b) => {
|
|
14812
|
-
if (!pluginState.pending)
|
|
14813
|
-
return;
|
|
14814
|
-
if (!pluginState.fiveModeEnabled)
|
|
14815
|
-
return;
|
|
14816
|
-
if (!b)
|
|
14817
|
-
return;
|
|
14818
|
-
pluginState.pending = false;
|
|
14819
|
-
enable();
|
|
14820
|
-
render();
|
|
14821
|
-
};
|
|
14822
|
-
const handleWantsPanGesture = (pose, final) => {
|
|
14823
|
-
if (pose) {
|
|
14824
|
-
handleRerender();
|
|
14825
|
-
}
|
|
14826
|
-
};
|
|
14827
|
-
const handlePanGesture = (pose, final) => {
|
|
14828
|
-
if (!pluginState.pending)
|
|
14829
|
-
return;
|
|
14830
|
-
if (!pluginState.fiveModeEnabled)
|
|
14831
|
-
return;
|
|
14832
|
-
if (!final)
|
|
14833
|
-
return;
|
|
14834
|
-
pluginState.pending = false;
|
|
14835
|
-
enable();
|
|
14836
|
-
render();
|
|
14837
|
-
};
|
|
14838
14831
|
const render = () => {
|
|
14839
14832
|
var _a;
|
|
14840
14833
|
if (!pluginState.wrapper)
|
|
@@ -14870,33 +14863,13 @@
|
|
|
14870
14863
|
const addListener4Five = () => {
|
|
14871
14864
|
five$1.on('modeChange', onFiveModeChange);
|
|
14872
14865
|
five$1.once('dispose', dispose);
|
|
14873
|
-
// five.on('wantsGesture', handleRerender)
|
|
14874
|
-
// five.on('gesture', rerender)
|
|
14875
|
-
five$1.on('wantsMouseWheel', handleRerender);
|
|
14876
|
-
five$1.on('mouseWheel', rerender);
|
|
14877
|
-
five$1.on('wantsInteriaPan', handleRerender);
|
|
14878
|
-
five$1.on('interiaPan', handleInteriaPanRerender);
|
|
14879
|
-
five$1.on('wantsPanGesture', handleWantsPanGesture);
|
|
14880
|
-
five$1.on('panGesture', handlePanGesture);
|
|
14881
|
-
five$1.on('wantsPinchGesture', handleRerender);
|
|
14882
|
-
five$1.on('pinchGesture', rerender);
|
|
14883
14866
|
};
|
|
14884
14867
|
// 取消 five 监听
|
|
14885
14868
|
const removeListener4Five = () => {
|
|
14886
14869
|
five$1.off('modeChange', onFiveModeChange);
|
|
14887
|
-
// five.off('wantsGesture', handleRerender)
|
|
14888
|
-
// five.off('gesture', rerender)
|
|
14889
|
-
five$1.off('wantsMouseWheel', handleRerender);
|
|
14890
|
-
five$1.off('mouseWheel', rerender);
|
|
14891
|
-
five$1.off('wantsInteriaPan', handleRerender);
|
|
14892
|
-
five$1.off('interiaPan', handleInteriaPanRerender);
|
|
14893
|
-
five$1.off('wantsPanGesture', handleWantsPanGesture);
|
|
14894
|
-
five$1.off('panGesture', handlePanGesture);
|
|
14895
|
-
five$1.off('wantsPinchGesture', handleRerender);
|
|
14896
|
-
five$1.off('pinchGesture', rerender);
|
|
14897
14870
|
};
|
|
14898
14871
|
const onFiveModeChange = (mode) => {
|
|
14899
|
-
if (!pluginState.enabled
|
|
14872
|
+
if (!pluginState.enabled)
|
|
14900
14873
|
return;
|
|
14901
14874
|
if (mode !== five.Five.Mode.Floorplan) {
|
|
14902
14875
|
pluginState.fiveModeEnabled = false;
|