@realsee/dnalogel 2.0.0-alpha.30 → 2.0.0-alpha.32
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/PanoRulerPlugin/index.js +3 -2
- package/dist/floorplan/ModelFloorplanPlugin/index.js +3 -2
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +3 -2
- package/dist/index.es.js +65 -43
- package/dist/index.js +68 -46
- package/dist/index.umd.js +68 -46
- 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/libs/PanoRulerPlugin/Plugin.js +3 -2
- package/libs/floorplan/Components/Main.js +2 -2
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +1 -0
- package/libs/floorplan/TopviewFloorplanPlugin/style.js +1 -0
- package/package.json +2 -2
- package/CHANGELOG.md +0 -108
package/dist/index.js
CHANGED
|
@@ -1030,6 +1030,7 @@ const pluginStyle$1 = {
|
|
|
1030
1030
|
top: '50%',
|
|
1031
1031
|
transform: 'translate(-50%, -50%)',
|
|
1032
1032
|
zIndex: '10',
|
|
1033
|
+
pointerEvents: 'none'
|
|
1033
1034
|
};
|
|
1034
1035
|
|
|
1035
1036
|
const FLOORPLAN_EXTRA_OBJECT_IMAGE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAwCAYAAACFUvPfAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALaADAAQAAAABAAAAMAAAAADe2FZjAAAEF0lEQVRoBe2WzWskRRiHf13V092TxI2oEzYeVDwITtyDuCiihwiCePGgxIM3vYgHL4J4UIhBRA8i/gPqyUvWg7AiIuIeloDiYUHJLOK6BPwIk9nNODM9Xf1RVe1b3elJRjCZmQ6euqGmuqer33rq4e23GqiOykBloDJQGagMVAYqA5WBykBlYFYD1qwP/tdzaZqOx9zYOLxeX0+L5yzLGp0X/03a25MOnGRcBtx+6Rlo9SL08G4EooFnxa8Yiivox5/h5Ys/4cl7NVorNDRnngX+0MIkVMeMSf23zyKML8J7/Dy8hwF2Buh9CnS+AEQIdLspBuGb+M7/qLW4qJrNpsLapjYhpwVnx3BMfCtNNx3Etc9xywvnMf80wG8HmQainw0RxSGrnmeBp+8k5/j9S0HbvXb5io0Lz880/0wPHV1NlhLd316He+4xOCv5ragF7L9PrH1qBJyB0626x/lC+qrSvH5r/W+n1WpxUM5nMY4GPeH8lHJaPgfeAFQHCL+ntkXT+vnUc3W6pvTIwC0wy3rA4dwLmK2avZ7Eo9uKBuYJfgJscbs8dLCxDMt+EOEPBEZNEWyBYHqTz6bPXrzUnNrSShxHIsYiOL69zrCGLLcLqJP68tB+9w5wj+YhWDafQ2s61wNqxjZhmrQ2pvMFCEvXuCUZ7wqH794ZWs28LJqlTXSUyuksF2M/yOwqgkx2c1ADa4wLAQRk2sAGQQakhN6yFC2hltfz5kSY44NKQeeh+vtI/SSzWhg2CzCgmWISmKUGmaYFBDfCSymnfxJ6/+ospVcWOLLp5DGP/y0P/Rp66O99DQNq7Po3Ds0a0wY+My2QSv2N2mO/OyxR2o6UQk+Lv7yJ06JYSnnolZVU9cUn2O9SmaMWGFBqYXRwbqAJWIi94TX5biotpcGl1DXZ6LnqIbNDTnmUgi52Mv5l5ysMxIcZcGjy2DTK4ZHlcBC14zeSge4qphICjj3bS0A7o9nSp2TOkm7aZ8bGZy/jxhO87V91G0+dfY/Z7BWIIK9KYUi5qy/Hf8YfBG3sqJTHiQWhmTVkbip+wX3x6volVSx+LPAxF+VLXhZ8VQ+iP2Rta/iWe5v42Fngj0BbdnRTXh12ZIcKhTaGbcYjybRwXBU1lu9KlndXp04NM52poKWO0RZsviNaP9a6grkO972+st05pXhE5c1hTEluJy7XUejGUQNLMbAmTdWY1rKBLW3aTJqBZ7nZkb36DhYCreeYHbMUXHvaYi5XDK70EcgulmRjm77wNtenzuXCbmnTRaAx493rbGf3Jr/njMzj920CnKdUaFCjlDioy7NYNvOdGrQJNgI32/L2tkXfFPlxgToqjWVhD6KdLnQRdARf/HHQz2r2X2Gqy8pAZaAyUBmoDFQGKgP/q4F/AJYg9/s0ZoABAAAAAElFTkSuQmCC';
|
|
@@ -3893,7 +3894,7 @@ class CurrentFloor$1 extends internal.SvelteComponent {
|
|
|
3893
3894
|
/* src/floorplan/Components/Main.svelte generated by Svelte v3.47.0 */
|
|
3894
3895
|
|
|
3895
3896
|
function add_css$9(target) {
|
|
3896
|
-
internal.append_styles(target, "svelte-
|
|
3897
|
+
internal.append_styles(target, "svelte-86bqav", ".floorplan-main.svelte-86bqav{width:100%;height:100%;pointer-events:none}");
|
|
3897
3898
|
}
|
|
3898
3899
|
|
|
3899
3900
|
function get_each_context$4(ctx, list, i) {
|
|
@@ -3951,7 +3952,7 @@ function create_if_block$4(ctx) {
|
|
|
3951
3952
|
internal.create_component(camera.$$.fragment);
|
|
3952
3953
|
t1 = internal.space();
|
|
3953
3954
|
if (if_block) if_block.c();
|
|
3954
|
-
internal.attr(div, "class", "floorplan-main svelte-
|
|
3955
|
+
internal.attr(div, "class", "floorplan-main svelte-86bqav");
|
|
3955
3956
|
},
|
|
3956
3957
|
m(target, anchor) {
|
|
3957
3958
|
internal.insert(target, div, anchor);
|
|
@@ -6287,6 +6288,7 @@ class ModelFloorplanPluginController {
|
|
|
6287
6288
|
top: '50%',
|
|
6288
6289
|
transform: 'translate(-50%, -50%)',
|
|
6289
6290
|
zIndex: 10,
|
|
6291
|
+
pointerEvents: 'none'
|
|
6290
6292
|
});
|
|
6291
6293
|
this.five.addExtraElement(this.container);
|
|
6292
6294
|
// 如果初始化的时候模型已经加载完毕了,就不用再等 modelLoaded
|
|
@@ -7357,7 +7359,7 @@ const PanoRulerPlugin = (five$1, params) => {
|
|
|
7357
7359
|
throw new Error('标尺数据依赖不齐全!');
|
|
7358
7360
|
}
|
|
7359
7361
|
state.loaded = false;
|
|
7360
|
-
state.options = Object.assign({}, state.options, options || {});
|
|
7362
|
+
state.options = Object.assign(Object.assign({}, state.options), options || {});
|
|
7361
7363
|
if (five$1.model.loaded) {
|
|
7362
7364
|
return _load(roomInfo, roomRules);
|
|
7363
7365
|
}
|
|
@@ -7459,7 +7461,8 @@ const PanoRulerPlugin = (five$1, params) => {
|
|
|
7459
7461
|
$element.style.display = 'none';
|
|
7460
7462
|
continue;
|
|
7461
7463
|
}
|
|
7462
|
-
|
|
7464
|
+
// 线小于0.3m隐藏
|
|
7465
|
+
if (start.distanceTo(end) < 0.3) {
|
|
7463
7466
|
$element.style.display = 'none';
|
|
7464
7467
|
continue;
|
|
7465
7468
|
}
|
|
@@ -13793,7 +13796,7 @@ function create_if_block$1(ctx) {
|
|
|
13793
13796
|
div1 = internal.element("div");
|
|
13794
13797
|
div0 = internal.element("div");
|
|
13795
13798
|
internal.attr(div0, "class", "icon svelte-4rvov0");
|
|
13796
|
-
internal.attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon
|
|
13799
|
+
internal.attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`);
|
|
13797
13800
|
internal.attr(div1, "class", "icon-wrap svelte-4rvov0");
|
|
13798
13801
|
},
|
|
13799
13802
|
m(target, anchor) {
|
|
@@ -13806,7 +13809,7 @@ function create_if_block$1(ctx) {
|
|
|
13806
13809
|
}
|
|
13807
13810
|
},
|
|
13808
13811
|
p(ctx, dirty) {
|
|
13809
|
-
if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon
|
|
13812
|
+
if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`)) {
|
|
13810
13813
|
internal.attr(div0, "style", div0_style_value);
|
|
13811
13814
|
}
|
|
13812
13815
|
},
|
|
@@ -13824,7 +13827,7 @@ function create_fragment$1(ctx) {
|
|
|
13824
13827
|
let t0;
|
|
13825
13828
|
let div0;
|
|
13826
13829
|
let span0;
|
|
13827
|
-
let t1_value = (/*itemLabel*/ ctx[0].code
|
|
13830
|
+
let t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "";
|
|
13828
13831
|
let t1;
|
|
13829
13832
|
let t2;
|
|
13830
13833
|
let span1;
|
|
@@ -13896,7 +13899,7 @@ function create_fragment$1(ctx) {
|
|
|
13896
13899
|
if_block = null;
|
|
13897
13900
|
}
|
|
13898
13901
|
|
|
13899
|
-
if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code
|
|
13902
|
+
if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "")) internal.set_data(t1, t1_value);
|
|
13900
13903
|
if (dirty & /*itemLabel*/ 1 && t3_value !== (t3_value = /*itemLabel*/ ctx[0].name + "")) internal.set_data(t3, t3_value);
|
|
13901
13904
|
|
|
13902
13905
|
if (dirty & /*itemLabel*/ 1) {
|
|
@@ -13934,14 +13937,13 @@ function create_fragment$1(ctx) {
|
|
|
13934
13937
|
};
|
|
13935
13938
|
}
|
|
13936
13939
|
|
|
13937
|
-
const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n';
|
|
13938
|
-
|
|
13939
13940
|
function instance$1($$self, $$props, $$invalidate) {
|
|
13940
13941
|
let { itemLabel } = $$props;
|
|
13941
13942
|
let { hooks } = $$props;
|
|
13942
13943
|
let { anchorEnabled } = $$props;
|
|
13943
13944
|
let { onIconClick } = $$props;
|
|
13944
13945
|
|
|
13946
|
+
// const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n'
|
|
13945
13947
|
function onClick() {
|
|
13946
13948
|
hooks.emit('onLabelClick', itemLabel);
|
|
13947
13949
|
}
|
|
@@ -13988,7 +13990,8 @@ const isImpacted = (five, sourceVector, targetVector, distance) => {
|
|
|
13988
13990
|
const raycaster = new Raycaster();
|
|
13989
13991
|
raycaster.set(targetVector, direction);
|
|
13990
13992
|
const [intersection] = five.model.intersectRaycaster(raycaster);
|
|
13991
|
-
return intersection &&
|
|
13993
|
+
return intersection && intersection.distance + 0.01 < distance;
|
|
13994
|
+
// return intersection && distance <= intersection.distance + 0.1
|
|
13992
13995
|
};
|
|
13993
13996
|
|
|
13994
13997
|
/**
|
|
@@ -14024,18 +14027,18 @@ function add_css(target) {
|
|
|
14024
14027
|
|
|
14025
14028
|
function get_each_context(ctx, list, i) {
|
|
14026
14029
|
const child_ctx = ctx.slice();
|
|
14027
|
-
child_ctx[
|
|
14030
|
+
child_ctx[32] = list[i];
|
|
14028
14031
|
return child_ctx;
|
|
14029
14032
|
}
|
|
14030
14033
|
|
|
14031
|
-
// (
|
|
14034
|
+
// (248:2) {#if itemLabelItem.visible}
|
|
14032
14035
|
function create_if_block(ctx) {
|
|
14033
14036
|
let itemlabelitem;
|
|
14034
14037
|
let current;
|
|
14035
14038
|
|
|
14036
14039
|
itemlabelitem = new ItemLabelItem({
|
|
14037
14040
|
props: {
|
|
14038
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
14041
|
+
itemLabel: /*itemLabelItem*/ ctx[32],
|
|
14039
14042
|
hooks: /*hooks*/ ctx[0],
|
|
14040
14043
|
anchorEnabled: /*anchorEnabled*/ ctx[2],
|
|
14041
14044
|
onIconClick: /*onIconClick*/ ctx[6]
|
|
@@ -14052,7 +14055,7 @@ function create_if_block(ctx) {
|
|
|
14052
14055
|
},
|
|
14053
14056
|
p(ctx, dirty) {
|
|
14054
14057
|
const itemlabelitem_changes = {};
|
|
14055
|
-
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[
|
|
14058
|
+
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[32];
|
|
14056
14059
|
if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
14057
14060
|
if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
|
|
14058
14061
|
itemlabelitem.$set(itemlabelitem_changes);
|
|
@@ -14072,12 +14075,12 @@ function create_if_block(ctx) {
|
|
|
14072
14075
|
};
|
|
14073
14076
|
}
|
|
14074
14077
|
|
|
14075
|
-
// (
|
|
14078
|
+
// (247:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
14076
14079
|
function create_each_block(key_1, ctx) {
|
|
14077
14080
|
let first;
|
|
14078
14081
|
let if_block_anchor;
|
|
14079
14082
|
let current;
|
|
14080
|
-
let if_block = /*itemLabelItem*/ ctx[
|
|
14083
|
+
let if_block = /*itemLabelItem*/ ctx[32].visible && create_if_block(ctx);
|
|
14081
14084
|
|
|
14082
14085
|
return {
|
|
14083
14086
|
key: key_1,
|
|
@@ -14097,7 +14100,7 @@ function create_each_block(key_1, ctx) {
|
|
|
14097
14100
|
p(new_ctx, dirty) {
|
|
14098
14101
|
ctx = new_ctx;
|
|
14099
14102
|
|
|
14100
|
-
if (/*itemLabelItem*/ ctx[
|
|
14103
|
+
if (/*itemLabelItem*/ ctx[32].visible) {
|
|
14101
14104
|
if (if_block) {
|
|
14102
14105
|
if_block.p(ctx, dirty);
|
|
14103
14106
|
|
|
@@ -14144,7 +14147,7 @@ function create_fragment(ctx) {
|
|
|
14144
14147
|
let div_resize_listener;
|
|
14145
14148
|
let current;
|
|
14146
14149
|
let each_value = /*renderItemLabels*/ ctx[1];
|
|
14147
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
14150
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[32].id;
|
|
14148
14151
|
|
|
14149
14152
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
14150
14153
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -14246,7 +14249,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14246
14249
|
* 1、当前楼层(假设先不考虑多楼层)
|
|
14247
14250
|
* 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
|
|
14248
14251
|
* */
|
|
14249
|
-
const
|
|
14252
|
+
const judgeImpacted = (five$1, itemLabel) => {
|
|
14250
14253
|
// 虚拟 VR 仅有一层,不考虑楼层信息
|
|
14251
14254
|
const cameraPosition = five$1.camera.position.clone();
|
|
14252
14255
|
|
|
@@ -14267,6 +14270,17 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14267
14270
|
// const [intersection] = five.model.intersectRaycaster(raycaster)
|
|
14268
14271
|
// return !(intersection && intersection.distance + 1 < vectorDistance);
|
|
14269
14272
|
|
|
14273
|
+
const judgeInViewport = modelPoint => {
|
|
14274
|
+
const { camera, model } = five$1;
|
|
14275
|
+
const { x: offsetXFromCenter, y: offsetYFromCenter, z: offsetZFromCenter } = modelPoint.clone().project(camera);
|
|
14276
|
+
const ratioFromLeft = (offsetXFromCenter + 1) / 2;
|
|
14277
|
+
const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
|
|
14278
|
+
const isFront = Math.abs(offsetZFromCenter) < 1;
|
|
14279
|
+
const cssOffset = [ratioFromLeft, ratioFromTop];
|
|
14280
|
+
const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
|
|
14281
|
+
return Boolean(isInViewport);
|
|
14282
|
+
};
|
|
14283
|
+
|
|
14270
14284
|
// cssOffset 获取
|
|
14271
14285
|
const getLabelCssOffset = (five, itemLabel) => {
|
|
14272
14286
|
const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
|
|
@@ -14283,19 +14297,26 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14283
14297
|
return [xOffset, yOffset];
|
|
14284
14298
|
};
|
|
14285
14299
|
|
|
14286
|
-
const getFormatedItemLabels = (five, labels) => {
|
|
14300
|
+
const getFormatedItemLabels = (five$1, labels) => {
|
|
14287
14301
|
// 计算位置 & 可见性
|
|
14288
14302
|
const newLabels = labels.map(label => {
|
|
14289
|
-
const cssOffset = getLabelCssOffset(five, label);
|
|
14303
|
+
const cssOffset = getLabelCssOffset(five$1, label);
|
|
14290
14304
|
label.name.length * basicWidth;
|
|
14291
14305
|
const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
|
|
14292
14306
|
|
|
14293
14307
|
// 是否加入碰撞检测
|
|
14294
|
-
|
|
14295
|
-
|
|
14296
|
-
|
|
14308
|
+
// 配置加入碰撞检测,则判断碰撞检测
|
|
14309
|
+
// 在可见范围内, 仅在 Panorama 模态计算
|
|
14310
|
+
const isInViewport = five$1.currentMode === five.Five.Mode.Panorama
|
|
14311
|
+
? judgeInViewport(new Vector3(label.position[0], label.position[1], label.position[2]))
|
|
14312
|
+
: true;
|
|
14313
|
+
|
|
14314
|
+
// 碰撞
|
|
14315
|
+
const isBlocked = modelOcclusionEnable
|
|
14316
|
+
? judgeImpacted(five$1, label)
|
|
14317
|
+
: false;
|
|
14297
14318
|
|
|
14298
|
-
const visible =
|
|
14319
|
+
const visible = isInViewport && !isBlocked;
|
|
14299
14320
|
|
|
14300
14321
|
// 关掉重叠计算
|
|
14301
14322
|
// const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth)
|
|
@@ -14311,7 +14332,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14311
14332
|
|
|
14312
14333
|
const sortedItemLabelItems = newLabels.filter(({ visible }) => visible).map(label => ({
|
|
14313
14334
|
itemLabelItem: label,
|
|
14314
|
-
distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five.camera.position)
|
|
14335
|
+
distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five$1.camera.position)
|
|
14315
14336
|
})).sort((a, b) => a.distance - b.distance);
|
|
14316
14337
|
|
|
14317
14338
|
return newLabels.map(label => {
|
|
@@ -14326,24 +14347,11 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14326
14347
|
$$invalidate(1, renderItemLabels = getFormatedItemLabels(five$1, renderItemLabels));
|
|
14327
14348
|
};
|
|
14328
14349
|
|
|
14329
|
-
svelte.beforeUpdate(() => {
|
|
14330
|
-
addDataUpdateListener();
|
|
14331
|
-
});
|
|
14332
|
-
|
|
14333
14350
|
const handleCameraUpdateCallback = () => {
|
|
14334
14351
|
$$invalidate(5, itemsVisible = false);
|
|
14335
14352
|
handleCameraUpdate();
|
|
14336
14353
|
};
|
|
14337
14354
|
|
|
14338
|
-
svelte.onMount(() => {
|
|
14339
|
-
$$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
|
|
14340
|
-
curItemLabels = itemLabels;
|
|
14341
|
-
onItemLabelUpdate();
|
|
14342
|
-
addResizeListener();
|
|
14343
|
-
five$1.on('cameraUpdate', handleCameraUpdateCallback);
|
|
14344
|
-
five$1.on('modeChange', onFiveModeChange);
|
|
14345
|
-
});
|
|
14346
|
-
|
|
14347
14355
|
const onFiveModeChange = mode => {
|
|
14348
14356
|
$$invalidate(5, itemsVisible = false);
|
|
14349
14357
|
|
|
@@ -14391,12 +14399,6 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14391
14399
|
}
|
|
14392
14400
|
});
|
|
14393
14401
|
|
|
14394
|
-
svelte.onDestroy(() => {
|
|
14395
|
-
five$1.off('cameraUpdate', handleCameraUpdateCallback);
|
|
14396
|
-
five$1.off('modeChange', onFiveModeChange);
|
|
14397
|
-
resizeObserver.unobserve(wrapper);
|
|
14398
|
-
});
|
|
14399
|
-
|
|
14400
14402
|
const getNearObserverPano = (fromPositionVector, observers) => {
|
|
14401
14403
|
let candidates = [];
|
|
14402
14404
|
|
|
@@ -14434,6 +14436,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14434
14436
|
const observer = getNearObserverPano(fromPositionVector, observers);
|
|
14435
14437
|
|
|
14436
14438
|
if (observer) {
|
|
14439
|
+
console.log('--has observer--');
|
|
14437
14440
|
itemLabel.observerIndex = observer.panoIndex;
|
|
14438
14441
|
}
|
|
14439
14442
|
|
|
@@ -14466,6 +14469,25 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
14466
14469
|
}
|
|
14467
14470
|
};
|
|
14468
14471
|
|
|
14472
|
+
svelte.beforeUpdate(() => {
|
|
14473
|
+
addDataUpdateListener();
|
|
14474
|
+
});
|
|
14475
|
+
|
|
14476
|
+
svelte.onMount(() => {
|
|
14477
|
+
$$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
|
|
14478
|
+
curItemLabels = itemLabels;
|
|
14479
|
+
onItemLabelUpdate();
|
|
14480
|
+
addResizeListener();
|
|
14481
|
+
five$1.on('cameraUpdate', handleCameraUpdateCallback);
|
|
14482
|
+
five$1.on('modeChange', onFiveModeChange);
|
|
14483
|
+
});
|
|
14484
|
+
|
|
14485
|
+
svelte.onDestroy(() => {
|
|
14486
|
+
five$1.off('cameraUpdate', handleCameraUpdateCallback);
|
|
14487
|
+
five$1.off('modeChange', onFiveModeChange);
|
|
14488
|
+
resizeObserver.unobserve(wrapper);
|
|
14489
|
+
});
|
|
14490
|
+
|
|
14469
14491
|
function div_elementresize_handler() {
|
|
14470
14492
|
containerWidth = this.clientWidth;
|
|
14471
14493
|
containerHeight = this.clientHeight;
|
package/dist/index.umd.js
CHANGED
|
@@ -1018,6 +1018,7 @@
|
|
|
1018
1018
|
top: '50%',
|
|
1019
1019
|
transform: 'translate(-50%, -50%)',
|
|
1020
1020
|
zIndex: '10',
|
|
1021
|
+
pointerEvents: 'none'
|
|
1021
1022
|
};
|
|
1022
1023
|
|
|
1023
1024
|
const FLOORPLAN_EXTRA_OBJECT_IMAGE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAwCAYAAACFUvPfAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALaADAAQAAAABAAAAMAAAAADe2FZjAAAEF0lEQVRoBe2WzWskRRiHf13V092TxI2oEzYeVDwITtyDuCiihwiCePGgxIM3vYgHL4J4UIhBRA8i/gPqyUvWg7AiIuIeloDiYUHJLOK6BPwIk9nNODM9Xf1RVe1b3elJRjCZmQ6euqGmuqer33rq4e23GqiOykBloDJQGagMVAYqA5WBykBlYFYD1qwP/tdzaZqOx9zYOLxeX0+L5yzLGp0X/03a25MOnGRcBtx+6Rlo9SL08G4EooFnxa8Yiivox5/h5Ys/4cl7NVorNDRnngX+0MIkVMeMSf23zyKML8J7/Dy8hwF2Buh9CnS+AEQIdLspBuGb+M7/qLW4qJrNpsLapjYhpwVnx3BMfCtNNx3Etc9xywvnMf80wG8HmQainw0RxSGrnmeBp+8k5/j9S0HbvXb5io0Lz880/0wPHV1NlhLd316He+4xOCv5ragF7L9PrH1qBJyB0626x/lC+qrSvH5r/W+n1WpxUM5nMY4GPeH8lHJaPgfeAFQHCL+ntkXT+vnUc3W6pvTIwC0wy3rA4dwLmK2avZ7Eo9uKBuYJfgJscbs8dLCxDMt+EOEPBEZNEWyBYHqTz6bPXrzUnNrSShxHIsYiOL69zrCGLLcLqJP68tB+9w5wj+YhWDafQ2s61wNqxjZhmrQ2pvMFCEvXuCUZ7wqH794ZWs28LJqlTXSUyuksF2M/yOwqgkx2c1ADa4wLAQRk2sAGQQakhN6yFC2hltfz5kSY44NKQeeh+vtI/SSzWhg2CzCgmWISmKUGmaYFBDfCSymnfxJ6/+ospVcWOLLp5DGP/y0P/Rp66O99DQNq7Po3Ds0a0wY+My2QSv2N2mO/OyxR2o6UQk+Lv7yJ06JYSnnolZVU9cUn2O9SmaMWGFBqYXRwbqAJWIi94TX5biotpcGl1DXZ6LnqIbNDTnmUgi52Mv5l5ysMxIcZcGjy2DTK4ZHlcBC14zeSge4qphICjj3bS0A7o9nSp2TOkm7aZ8bGZy/jxhO87V91G0+dfY/Z7BWIIK9KYUi5qy/Hf8YfBG3sqJTHiQWhmTVkbip+wX3x6volVSx+LPAxF+VLXhZ8VQ+iP2Rta/iWe5v42Fngj0BbdnRTXh12ZIcKhTaGbcYjybRwXBU1lu9KlndXp04NM52poKWO0RZsviNaP9a6grkO972+st05pXhE5c1hTEluJy7XUejGUQNLMbAmTdWY1rKBLW3aTJqBZ7nZkb36DhYCreeYHbMUXHvaYi5XDK70EcgulmRjm77wNtenzuXCbmnTRaAx493rbGf3Jr/njMzj920CnKdUaFCjlDioy7NYNvOdGrQJNgI32/L2tkXfFPlxgToqjWVhD6KdLnQRdARf/HHQz2r2X2Gqy8pAZaAyUBmoDFQGKgP/q4F/AJYg9/s0ZoABAAAAAElFTkSuQmCC';
|
|
@@ -3881,7 +3882,7 @@
|
|
|
3881
3882
|
/* src/floorplan/Components/Main.svelte generated by Svelte v3.47.0 */
|
|
3882
3883
|
|
|
3883
3884
|
function add_css$9(target) {
|
|
3884
|
-
internal.append_styles(target, "svelte-
|
|
3885
|
+
internal.append_styles(target, "svelte-86bqav", ".floorplan-main.svelte-86bqav{width:100%;height:100%;pointer-events:none}");
|
|
3885
3886
|
}
|
|
3886
3887
|
|
|
3887
3888
|
function get_each_context$4(ctx, list, i) {
|
|
@@ -3939,7 +3940,7 @@
|
|
|
3939
3940
|
internal.create_component(camera.$$.fragment);
|
|
3940
3941
|
t1 = internal.space();
|
|
3941
3942
|
if (if_block) if_block.c();
|
|
3942
|
-
internal.attr(div, "class", "floorplan-main svelte-
|
|
3943
|
+
internal.attr(div, "class", "floorplan-main svelte-86bqav");
|
|
3943
3944
|
},
|
|
3944
3945
|
m(target, anchor) {
|
|
3945
3946
|
internal.insert(target, div, anchor);
|
|
@@ -6275,6 +6276,7 @@
|
|
|
6275
6276
|
top: '50%',
|
|
6276
6277
|
transform: 'translate(-50%, -50%)',
|
|
6277
6278
|
zIndex: 10,
|
|
6279
|
+
pointerEvents: 'none'
|
|
6278
6280
|
});
|
|
6279
6281
|
this.five.addExtraElement(this.container);
|
|
6280
6282
|
// 如果初始化的时候模型已经加载完毕了,就不用再等 modelLoaded
|
|
@@ -7345,7 +7347,7 @@
|
|
|
7345
7347
|
throw new Error('标尺数据依赖不齐全!');
|
|
7346
7348
|
}
|
|
7347
7349
|
state.loaded = false;
|
|
7348
|
-
state.options = Object.assign({}, state.options, options || {});
|
|
7350
|
+
state.options = Object.assign(Object.assign({}, state.options), options || {});
|
|
7349
7351
|
if (five$1.model.loaded) {
|
|
7350
7352
|
return _load(roomInfo, roomRules);
|
|
7351
7353
|
}
|
|
@@ -7447,7 +7449,8 @@
|
|
|
7447
7449
|
$element.style.display = 'none';
|
|
7448
7450
|
continue;
|
|
7449
7451
|
}
|
|
7450
|
-
|
|
7452
|
+
// 线小于0.3m隐藏
|
|
7453
|
+
if (start.distanceTo(end) < 0.3) {
|
|
7451
7454
|
$element.style.display = 'none';
|
|
7452
7455
|
continue;
|
|
7453
7456
|
}
|
|
@@ -13781,7 +13784,7 @@
|
|
|
13781
13784
|
div1 = internal.element("div");
|
|
13782
13785
|
div0 = internal.element("div");
|
|
13783
13786
|
internal.attr(div0, "class", "icon svelte-4rvov0");
|
|
13784
|
-
internal.attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon
|
|
13787
|
+
internal.attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`);
|
|
13785
13788
|
internal.attr(div1, "class", "icon-wrap svelte-4rvov0");
|
|
13786
13789
|
},
|
|
13787
13790
|
m(target, anchor) {
|
|
@@ -13794,7 +13797,7 @@
|
|
|
13794
13797
|
}
|
|
13795
13798
|
},
|
|
13796
13799
|
p(ctx, dirty) {
|
|
13797
|
-
if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon
|
|
13800
|
+
if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`)) {
|
|
13798
13801
|
internal.attr(div0, "style", div0_style_value);
|
|
13799
13802
|
}
|
|
13800
13803
|
},
|
|
@@ -13812,7 +13815,7 @@
|
|
|
13812
13815
|
let t0;
|
|
13813
13816
|
let div0;
|
|
13814
13817
|
let span0;
|
|
13815
|
-
let t1_value = (/*itemLabel*/ ctx[0].code
|
|
13818
|
+
let t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "";
|
|
13816
13819
|
let t1;
|
|
13817
13820
|
let t2;
|
|
13818
13821
|
let span1;
|
|
@@ -13884,7 +13887,7 @@
|
|
|
13884
13887
|
if_block = null;
|
|
13885
13888
|
}
|
|
13886
13889
|
|
|
13887
|
-
if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code
|
|
13890
|
+
if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "")) internal.set_data(t1, t1_value);
|
|
13888
13891
|
if (dirty & /*itemLabel*/ 1 && t3_value !== (t3_value = /*itemLabel*/ ctx[0].name + "")) internal.set_data(t3, t3_value);
|
|
13889
13892
|
|
|
13890
13893
|
if (dirty & /*itemLabel*/ 1) {
|
|
@@ -13922,14 +13925,13 @@
|
|
|
13922
13925
|
};
|
|
13923
13926
|
}
|
|
13924
13927
|
|
|
13925
|
-
const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n';
|
|
13926
|
-
|
|
13927
13928
|
function instance$1($$self, $$props, $$invalidate) {
|
|
13928
13929
|
let { itemLabel } = $$props;
|
|
13929
13930
|
let { hooks } = $$props;
|
|
13930
13931
|
let { anchorEnabled } = $$props;
|
|
13931
13932
|
let { onIconClick } = $$props;
|
|
13932
13933
|
|
|
13934
|
+
// const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n'
|
|
13933
13935
|
function onClick() {
|
|
13934
13936
|
hooks.emit('onLabelClick', itemLabel);
|
|
13935
13937
|
}
|
|
@@ -13976,7 +13978,8 @@
|
|
|
13976
13978
|
const raycaster = new Raycaster();
|
|
13977
13979
|
raycaster.set(targetVector, direction);
|
|
13978
13980
|
const [intersection] = five.model.intersectRaycaster(raycaster);
|
|
13979
|
-
return intersection &&
|
|
13981
|
+
return intersection && intersection.distance + 0.01 < distance;
|
|
13982
|
+
// return intersection && distance <= intersection.distance + 0.1
|
|
13980
13983
|
};
|
|
13981
13984
|
|
|
13982
13985
|
/**
|
|
@@ -14012,18 +14015,18 @@
|
|
|
14012
14015
|
|
|
14013
14016
|
function get_each_context(ctx, list, i) {
|
|
14014
14017
|
const child_ctx = ctx.slice();
|
|
14015
|
-
child_ctx[
|
|
14018
|
+
child_ctx[32] = list[i];
|
|
14016
14019
|
return child_ctx;
|
|
14017
14020
|
}
|
|
14018
14021
|
|
|
14019
|
-
// (
|
|
14022
|
+
// (248:2) {#if itemLabelItem.visible}
|
|
14020
14023
|
function create_if_block(ctx) {
|
|
14021
14024
|
let itemlabelitem;
|
|
14022
14025
|
let current;
|
|
14023
14026
|
|
|
14024
14027
|
itemlabelitem = new ItemLabelItem({
|
|
14025
14028
|
props: {
|
|
14026
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
14029
|
+
itemLabel: /*itemLabelItem*/ ctx[32],
|
|
14027
14030
|
hooks: /*hooks*/ ctx[0],
|
|
14028
14031
|
anchorEnabled: /*anchorEnabled*/ ctx[2],
|
|
14029
14032
|
onIconClick: /*onIconClick*/ ctx[6]
|
|
@@ -14040,7 +14043,7 @@
|
|
|
14040
14043
|
},
|
|
14041
14044
|
p(ctx, dirty) {
|
|
14042
14045
|
const itemlabelitem_changes = {};
|
|
14043
|
-
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[
|
|
14046
|
+
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[32];
|
|
14044
14047
|
if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
14045
14048
|
if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
|
|
14046
14049
|
itemlabelitem.$set(itemlabelitem_changes);
|
|
@@ -14060,12 +14063,12 @@
|
|
|
14060
14063
|
};
|
|
14061
14064
|
}
|
|
14062
14065
|
|
|
14063
|
-
// (
|
|
14066
|
+
// (247:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
14064
14067
|
function create_each_block(key_1, ctx) {
|
|
14065
14068
|
let first;
|
|
14066
14069
|
let if_block_anchor;
|
|
14067
14070
|
let current;
|
|
14068
|
-
let if_block = /*itemLabelItem*/ ctx[
|
|
14071
|
+
let if_block = /*itemLabelItem*/ ctx[32].visible && create_if_block(ctx);
|
|
14069
14072
|
|
|
14070
14073
|
return {
|
|
14071
14074
|
key: key_1,
|
|
@@ -14085,7 +14088,7 @@
|
|
|
14085
14088
|
p(new_ctx, dirty) {
|
|
14086
14089
|
ctx = new_ctx;
|
|
14087
14090
|
|
|
14088
|
-
if (/*itemLabelItem*/ ctx[
|
|
14091
|
+
if (/*itemLabelItem*/ ctx[32].visible) {
|
|
14089
14092
|
if (if_block) {
|
|
14090
14093
|
if_block.p(ctx, dirty);
|
|
14091
14094
|
|
|
@@ -14132,7 +14135,7 @@
|
|
|
14132
14135
|
let div_resize_listener;
|
|
14133
14136
|
let current;
|
|
14134
14137
|
let each_value = /*renderItemLabels*/ ctx[1];
|
|
14135
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
14138
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[32].id;
|
|
14136
14139
|
|
|
14137
14140
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
14138
14141
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -14234,7 +14237,7 @@
|
|
|
14234
14237
|
* 1、当前楼层(假设先不考虑多楼层)
|
|
14235
14238
|
* 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
|
|
14236
14239
|
* */
|
|
14237
|
-
const
|
|
14240
|
+
const judgeImpacted = (five$1, itemLabel) => {
|
|
14238
14241
|
// 虚拟 VR 仅有一层,不考虑楼层信息
|
|
14239
14242
|
const cameraPosition = five$1.camera.position.clone();
|
|
14240
14243
|
|
|
@@ -14255,6 +14258,17 @@
|
|
|
14255
14258
|
// const [intersection] = five.model.intersectRaycaster(raycaster)
|
|
14256
14259
|
// return !(intersection && intersection.distance + 1 < vectorDistance);
|
|
14257
14260
|
|
|
14261
|
+
const judgeInViewport = modelPoint => {
|
|
14262
|
+
const { camera, model } = five$1;
|
|
14263
|
+
const { x: offsetXFromCenter, y: offsetYFromCenter, z: offsetZFromCenter } = modelPoint.clone().project(camera);
|
|
14264
|
+
const ratioFromLeft = (offsetXFromCenter + 1) / 2;
|
|
14265
|
+
const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
|
|
14266
|
+
const isFront = Math.abs(offsetZFromCenter) < 1;
|
|
14267
|
+
const cssOffset = [ratioFromLeft, ratioFromTop];
|
|
14268
|
+
const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
|
|
14269
|
+
return Boolean(isInViewport);
|
|
14270
|
+
};
|
|
14271
|
+
|
|
14258
14272
|
// cssOffset 获取
|
|
14259
14273
|
const getLabelCssOffset = (five, itemLabel) => {
|
|
14260
14274
|
const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
|
|
@@ -14271,19 +14285,26 @@
|
|
|
14271
14285
|
return [xOffset, yOffset];
|
|
14272
14286
|
};
|
|
14273
14287
|
|
|
14274
|
-
const getFormatedItemLabels = (five, labels) => {
|
|
14288
|
+
const getFormatedItemLabels = (five$1, labels) => {
|
|
14275
14289
|
// 计算位置 & 可见性
|
|
14276
14290
|
const newLabels = labels.map(label => {
|
|
14277
|
-
const cssOffset = getLabelCssOffset(five, label);
|
|
14291
|
+
const cssOffset = getLabelCssOffset(five$1, label);
|
|
14278
14292
|
label.name.length * basicWidth;
|
|
14279
14293
|
const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
|
|
14280
14294
|
|
|
14281
14295
|
// 是否加入碰撞检测
|
|
14282
|
-
|
|
14283
|
-
|
|
14284
|
-
|
|
14296
|
+
// 配置加入碰撞检测,则判断碰撞检测
|
|
14297
|
+
// 在可见范围内, 仅在 Panorama 模态计算
|
|
14298
|
+
const isInViewport = five$1.currentMode === five.Five.Mode.Panorama
|
|
14299
|
+
? judgeInViewport(new Vector3(label.position[0], label.position[1], label.position[2]))
|
|
14300
|
+
: true;
|
|
14301
|
+
|
|
14302
|
+
// 碰撞
|
|
14303
|
+
const isBlocked = modelOcclusionEnable
|
|
14304
|
+
? judgeImpacted(five$1, label)
|
|
14305
|
+
: false;
|
|
14285
14306
|
|
|
14286
|
-
const visible =
|
|
14307
|
+
const visible = isInViewport && !isBlocked;
|
|
14287
14308
|
|
|
14288
14309
|
// 关掉重叠计算
|
|
14289
14310
|
// const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth)
|
|
@@ -14299,7 +14320,7 @@
|
|
|
14299
14320
|
|
|
14300
14321
|
const sortedItemLabelItems = newLabels.filter(({ visible }) => visible).map(label => ({
|
|
14301
14322
|
itemLabelItem: label,
|
|
14302
|
-
distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five.camera.position)
|
|
14323
|
+
distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five$1.camera.position)
|
|
14303
14324
|
})).sort((a, b) => a.distance - b.distance);
|
|
14304
14325
|
|
|
14305
14326
|
return newLabels.map(label => {
|
|
@@ -14314,24 +14335,11 @@
|
|
|
14314
14335
|
$$invalidate(1, renderItemLabels = getFormatedItemLabels(five$1, renderItemLabels));
|
|
14315
14336
|
};
|
|
14316
14337
|
|
|
14317
|
-
svelte.beforeUpdate(() => {
|
|
14318
|
-
addDataUpdateListener();
|
|
14319
|
-
});
|
|
14320
|
-
|
|
14321
14338
|
const handleCameraUpdateCallback = () => {
|
|
14322
14339
|
$$invalidate(5, itemsVisible = false);
|
|
14323
14340
|
handleCameraUpdate();
|
|
14324
14341
|
};
|
|
14325
14342
|
|
|
14326
|
-
svelte.onMount(() => {
|
|
14327
|
-
$$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
|
|
14328
|
-
curItemLabels = itemLabels;
|
|
14329
|
-
onItemLabelUpdate();
|
|
14330
|
-
addResizeListener();
|
|
14331
|
-
five$1.on('cameraUpdate', handleCameraUpdateCallback);
|
|
14332
|
-
five$1.on('modeChange', onFiveModeChange);
|
|
14333
|
-
});
|
|
14334
|
-
|
|
14335
14343
|
const onFiveModeChange = mode => {
|
|
14336
14344
|
$$invalidate(5, itemsVisible = false);
|
|
14337
14345
|
|
|
@@ -14379,12 +14387,6 @@
|
|
|
14379
14387
|
}
|
|
14380
14388
|
});
|
|
14381
14389
|
|
|
14382
|
-
svelte.onDestroy(() => {
|
|
14383
|
-
five$1.off('cameraUpdate', handleCameraUpdateCallback);
|
|
14384
|
-
five$1.off('modeChange', onFiveModeChange);
|
|
14385
|
-
resizeObserver.unobserve(wrapper);
|
|
14386
|
-
});
|
|
14387
|
-
|
|
14388
14390
|
const getNearObserverPano = (fromPositionVector, observers) => {
|
|
14389
14391
|
let candidates = [];
|
|
14390
14392
|
|
|
@@ -14422,6 +14424,7 @@
|
|
|
14422
14424
|
const observer = getNearObserverPano(fromPositionVector, observers);
|
|
14423
14425
|
|
|
14424
14426
|
if (observer) {
|
|
14427
|
+
console.log('--has observer--');
|
|
14425
14428
|
itemLabel.observerIndex = observer.panoIndex;
|
|
14426
14429
|
}
|
|
14427
14430
|
|
|
@@ -14454,6 +14457,25 @@
|
|
|
14454
14457
|
}
|
|
14455
14458
|
};
|
|
14456
14459
|
|
|
14460
|
+
svelte.beforeUpdate(() => {
|
|
14461
|
+
addDataUpdateListener();
|
|
14462
|
+
});
|
|
14463
|
+
|
|
14464
|
+
svelte.onMount(() => {
|
|
14465
|
+
$$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
|
|
14466
|
+
curItemLabels = itemLabels;
|
|
14467
|
+
onItemLabelUpdate();
|
|
14468
|
+
addResizeListener();
|
|
14469
|
+
five$1.on('cameraUpdate', handleCameraUpdateCallback);
|
|
14470
|
+
five$1.on('modeChange', onFiveModeChange);
|
|
14471
|
+
});
|
|
14472
|
+
|
|
14473
|
+
svelte.onDestroy(() => {
|
|
14474
|
+
five$1.off('cameraUpdate', handleCameraUpdateCallback);
|
|
14475
|
+
five$1.off('modeChange', onFiveModeChange);
|
|
14476
|
+
resizeObserver.unobserve(wrapper);
|
|
14477
|
+
});
|
|
14478
|
+
|
|
14457
14479
|
function div_elementresize_handler() {
|
|
14458
14480
|
containerWidth = this.clientWidth;
|
|
14459
14481
|
containerHeight = this.clientHeight;
|