@realsee/dnalogel 2.0.0-alpha.38 → 2.0.0-alpha.39
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 +60 -36
- package/dist/ItemLabelPlugin/typings.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +63 -37
- package/dist/index.js +63 -36
- package/dist/index.umd.js +63 -36
- package/docs/assets/search.js +1 -1
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- 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/Rotation.html +2 -2
- package/docs/index.html +2 -2
- 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/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/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/PanoRulerProPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginState.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/modules.html +18 -18
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +34 -21
- package/libs/ItemLabelPlugin/Plugin.js +16 -10
- package/libs/ItemLabelPlugin/typings.d.ts +4 -0
- package/libs/ItemLabelPlugin/utils/parseData.js +1 -1
- package/libs/index.d.ts +1 -0
- package/libs/index.js +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15601,18 +15601,18 @@ function add_css(target) {
|
|
|
15601
15601
|
|
|
15602
15602
|
function get_each_context(ctx, list, i) {
|
|
15603
15603
|
const child_ctx = ctx.slice();
|
|
15604
|
-
child_ctx[
|
|
15604
|
+
child_ctx[31] = list[i];
|
|
15605
15605
|
return child_ctx;
|
|
15606
15606
|
}
|
|
15607
15607
|
|
|
15608
|
-
// (
|
|
15608
|
+
// (235:2) {#if itemLabelItem.visible}
|
|
15609
15609
|
function create_if_block(ctx) {
|
|
15610
15610
|
let itemlabelitem;
|
|
15611
15611
|
let current;
|
|
15612
15612
|
|
|
15613
15613
|
itemlabelitem = new ItemLabelItem({
|
|
15614
15614
|
props: {
|
|
15615
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
15615
|
+
itemLabel: /*itemLabelItem*/ ctx[31],
|
|
15616
15616
|
hooks: /*hooks*/ ctx[0],
|
|
15617
15617
|
anchorEnabled: /*anchorEnabled*/ ctx[2],
|
|
15618
15618
|
onIconClick: /*onIconClick*/ ctx[6]
|
|
@@ -15629,7 +15629,7 @@ function create_if_block(ctx) {
|
|
|
15629
15629
|
},
|
|
15630
15630
|
p(ctx, dirty) {
|
|
15631
15631
|
const itemlabelitem_changes = {};
|
|
15632
|
-
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[
|
|
15632
|
+
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[31];
|
|
15633
15633
|
if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
15634
15634
|
if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
|
|
15635
15635
|
itemlabelitem.$set(itemlabelitem_changes);
|
|
@@ -15649,12 +15649,12 @@ function create_if_block(ctx) {
|
|
|
15649
15649
|
};
|
|
15650
15650
|
}
|
|
15651
15651
|
|
|
15652
|
-
// (
|
|
15652
|
+
// (234:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
15653
15653
|
function create_each_block(key_1, ctx) {
|
|
15654
15654
|
let first;
|
|
15655
15655
|
let if_block_anchor;
|
|
15656
15656
|
let current;
|
|
15657
|
-
let if_block = /*itemLabelItem*/ ctx[
|
|
15657
|
+
let if_block = /*itemLabelItem*/ ctx[31].visible && create_if_block(ctx);
|
|
15658
15658
|
|
|
15659
15659
|
return {
|
|
15660
15660
|
key: key_1,
|
|
@@ -15674,7 +15674,7 @@ function create_each_block(key_1, ctx) {
|
|
|
15674
15674
|
p(new_ctx, dirty) {
|
|
15675
15675
|
ctx = new_ctx;
|
|
15676
15676
|
|
|
15677
|
-
if (/*itemLabelItem*/ ctx[
|
|
15677
|
+
if (/*itemLabelItem*/ ctx[31].visible) {
|
|
15678
15678
|
if (if_block) {
|
|
15679
15679
|
if_block.p(ctx, dirty);
|
|
15680
15680
|
|
|
@@ -15721,7 +15721,7 @@ function create_fragment(ctx) {
|
|
|
15721
15721
|
let div_resize_listener;
|
|
15722
15722
|
let current;
|
|
15723
15723
|
let each_value = /*renderItemLabels*/ ctx[1];
|
|
15724
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
15724
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[31].id;
|
|
15725
15725
|
|
|
15726
15726
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
15727
15727
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -15738,7 +15738,7 @@ function create_fragment(ctx) {
|
|
|
15738
15738
|
}
|
|
15739
15739
|
|
|
15740
15740
|
internal.attr(div, "class", "item-labels-container svelte-gk8s47");
|
|
15741
|
-
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[
|
|
15741
|
+
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[13].call(div));
|
|
15742
15742
|
internal.set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
|
|
15743
15743
|
},
|
|
15744
15744
|
m(target, anchor) {
|
|
@@ -15748,7 +15748,7 @@ function create_fragment(ctx) {
|
|
|
15748
15748
|
each_blocks[i].m(div, null);
|
|
15749
15749
|
}
|
|
15750
15750
|
|
|
15751
|
-
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[
|
|
15751
|
+
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[13].bind(div));
|
|
15752
15752
|
current = true;
|
|
15753
15753
|
},
|
|
15754
15754
|
p(ctx, dirty) {
|
|
@@ -15796,6 +15796,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
15796
15796
|
const { Raycaster, Vector3 } = THREE__namespace;
|
|
15797
15797
|
let { five: five$1 } = $$props;
|
|
15798
15798
|
let { modelOcclusionEnable } = $$props;
|
|
15799
|
+
let { onlyVisibleInPanorama } = $$props;
|
|
15799
15800
|
let { itemLabels } = $$props;
|
|
15800
15801
|
let { hooks } = $$props;
|
|
15801
15802
|
let { displayStrategyType } = $$props;
|
|
@@ -15847,7 +15848,10 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
15847
15848
|
const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
|
|
15848
15849
|
const isFront = Math.abs(offsetZFromCenter) < 1;
|
|
15849
15850
|
const cssOffset = [ratioFromLeft, ratioFromTop];
|
|
15851
|
+
|
|
15852
|
+
// 只计算在前面就行
|
|
15850
15853
|
const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
|
|
15854
|
+
|
|
15851
15855
|
return Boolean(isInViewport);
|
|
15852
15856
|
};
|
|
15853
15857
|
|
|
@@ -15868,8 +15872,15 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
15868
15872
|
};
|
|
15869
15873
|
|
|
15870
15874
|
const getFormatedItemLabels = (five$1, labels) => {
|
|
15875
|
+
console.log(labels);
|
|
15876
|
+
|
|
15871
15877
|
// 计算位置 & 可见性
|
|
15872
15878
|
const newLabels = labels.map(label => {
|
|
15879
|
+
// 不在绑定点位则直接不可见
|
|
15880
|
+
if (five$1.state.panoIndex !== label.panoIndex) {
|
|
15881
|
+
return Object.assign(Object.assign({}, label), { visible: false });
|
|
15882
|
+
}
|
|
15883
|
+
|
|
15873
15884
|
const cssOffset = getLabelCssOffset(five$1, label);
|
|
15874
15885
|
label.name.length * basicWidth;
|
|
15875
15886
|
const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
|
|
@@ -15922,16 +15933,6 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
15922
15933
|
handleCameraUpdate();
|
|
15923
15934
|
};
|
|
15924
15935
|
|
|
15925
|
-
const onFiveModeChange = mode => {
|
|
15926
|
-
$$invalidate(5, itemsVisible = false);
|
|
15927
|
-
|
|
15928
|
-
five$1.once('initAnimationEnded', (panoIndex, pose, userAction) => {
|
|
15929
|
-
$$invalidate(2, anchorEnabled = mode === five.Five.Mode.Panorama);
|
|
15930
|
-
$$invalidate(5, itemsVisible = true);
|
|
15931
|
-
if (!userAction) return; else onItemLabelUpdate();
|
|
15932
|
-
});
|
|
15933
|
-
};
|
|
15934
|
-
|
|
15935
15936
|
const handleCameraUpdate = debounce(
|
|
15936
15937
|
() => {
|
|
15937
15938
|
$$invalidate(5, itemsVisible = true);
|
|
@@ -15989,11 +15990,10 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
15989
15990
|
const onIconClick = itemLabel => {
|
|
15990
15991
|
if (five$1.state.mode === five.Five.Mode.Panorama) return;
|
|
15991
15992
|
const observers = five$1.work.observers;
|
|
15992
|
-
const fromPositionVector = new Vector3(
|
|
15993
|
+
const fromPositionVector = new Vector3().fromArray(itemLabel.position);
|
|
15993
15994
|
const observer = getNearObserverPano(fromPositionVector, observers);
|
|
15994
15995
|
|
|
15995
15996
|
if (observer) {
|
|
15996
|
-
console.log('--has observer--');
|
|
15997
15997
|
itemLabel.observerIndex = observer.panoIndex;
|
|
15998
15998
|
}
|
|
15999
15999
|
|
|
@@ -16036,12 +16036,12 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
16036
16036
|
onItemLabelUpdate();
|
|
16037
16037
|
addResizeListener();
|
|
16038
16038
|
five$1.on('cameraUpdate', handleCameraUpdateCallback);
|
|
16039
|
-
|
|
16040
|
-
});
|
|
16039
|
+
}); // five.on('modeChange', onFiveModeChange)
|
|
16041
16040
|
|
|
16042
16041
|
svelte.onDestroy(() => {
|
|
16043
16042
|
five$1.off('cameraUpdate', handleCameraUpdateCallback);
|
|
16044
|
-
|
|
16043
|
+
|
|
16044
|
+
// five.off('modeChange', onFiveModeChange)
|
|
16045
16045
|
window.removeEventListener('resize', onResize, false);
|
|
16046
16046
|
});
|
|
16047
16047
|
|
|
@@ -16055,10 +16055,11 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
16055
16055
|
$$self.$$set = $$props => {
|
|
16056
16056
|
if ('five' in $$props) $$invalidate(7, five$1 = $$props.five);
|
|
16057
16057
|
if ('modelOcclusionEnable' in $$props) $$invalidate(8, modelOcclusionEnable = $$props.modelOcclusionEnable);
|
|
16058
|
-
if ('
|
|
16058
|
+
if ('onlyVisibleInPanorama' in $$props) $$invalidate(9, onlyVisibleInPanorama = $$props.onlyVisibleInPanorama);
|
|
16059
|
+
if ('itemLabels' in $$props) $$invalidate(10, itemLabels = $$props.itemLabels);
|
|
16059
16060
|
if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
|
|
16060
|
-
if ('displayStrategyType' in $$props) $$invalidate(
|
|
16061
|
-
if ('maxVisibleDistance' in $$props) $$invalidate(
|
|
16061
|
+
if ('displayStrategyType' in $$props) $$invalidate(11, displayStrategyType = $$props.displayStrategyType);
|
|
16062
|
+
if ('maxVisibleDistance' in $$props) $$invalidate(12, maxVisibleDistance = $$props.maxVisibleDistance);
|
|
16062
16063
|
};
|
|
16063
16064
|
|
|
16064
16065
|
return [
|
|
@@ -16071,6 +16072,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
16071
16072
|
onIconClick,
|
|
16072
16073
|
five$1,
|
|
16073
16074
|
modelOcclusionEnable,
|
|
16075
|
+
onlyVisibleInPanorama,
|
|
16074
16076
|
itemLabels,
|
|
16075
16077
|
displayStrategyType,
|
|
16076
16078
|
maxVisibleDistance,
|
|
@@ -16091,10 +16093,11 @@ class ItemLabelComponent extends internal.SvelteComponent {
|
|
|
16091
16093
|
{
|
|
16092
16094
|
five: 7,
|
|
16093
16095
|
modelOcclusionEnable: 8,
|
|
16094
|
-
|
|
16096
|
+
onlyVisibleInPanorama: 9,
|
|
16097
|
+
itemLabels: 10,
|
|
16095
16098
|
hooks: 0,
|
|
16096
|
-
displayStrategyType:
|
|
16097
|
-
maxVisibleDistance:
|
|
16099
|
+
displayStrategyType: 11,
|
|
16100
|
+
maxVisibleDistance: 12
|
|
16098
16101
|
},
|
|
16099
16102
|
add_css,
|
|
16100
16103
|
[-1, -1]
|
|
@@ -16104,12 +16107,12 @@ class ItemLabelComponent extends internal.SvelteComponent {
|
|
|
16104
16107
|
|
|
16105
16108
|
/** @description 转成内部所需数据 */
|
|
16106
16109
|
function parseItemLabelPluginData(data) {
|
|
16107
|
-
return data.item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined }
|
|
16110
|
+
return data.item_labels.map(label => (Object.assign(Object.assign({}, label), { modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined })));
|
|
16108
16111
|
}
|
|
16109
16112
|
|
|
16110
16113
|
const defaultMaxVisibleDistance = undefined;
|
|
16111
16114
|
const Plugin = (five$1, params) => {
|
|
16112
|
-
var _a, _b, _c;
|
|
16115
|
+
var _a, _b, _c, _d;
|
|
16113
16116
|
const pluginState = {
|
|
16114
16117
|
container: document.createElement('div'),
|
|
16115
16118
|
data: null,
|
|
@@ -16120,8 +16123,9 @@ const Plugin = (five$1, params) => {
|
|
|
16120
16123
|
app: undefined,
|
|
16121
16124
|
hooks: new five.Subscribe(),
|
|
16122
16125
|
modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
|
|
16123
|
-
|
|
16124
|
-
|
|
16126
|
+
onlyVisibleInPanorama: (_b = params === null || params === void 0 ? void 0 : params.onlyVisibleInPanorama) !== null && _b !== void 0 ? _b : true,
|
|
16127
|
+
displayStrategyType: (_c = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _c !== void 0 ? _c : exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL,
|
|
16128
|
+
maxVisibleDistance: (_d = params === null || params === void 0 ? void 0 : params.maxVisibleDistance) !== null && _d !== void 0 ? _d : defaultMaxVisibleDistance,
|
|
16125
16129
|
};
|
|
16126
16130
|
pluginState.container.setAttribute('class', 'item-label-plugin-container');
|
|
16127
16131
|
pluginState.container.style.cssText = `
|
|
@@ -16158,6 +16162,7 @@ const Plugin = (five$1, params) => {
|
|
|
16158
16162
|
return true;
|
|
16159
16163
|
};
|
|
16160
16164
|
const dispose = () => {
|
|
16165
|
+
removeListener4Five();
|
|
16161
16166
|
pluginState.container.remove();
|
|
16162
16167
|
};
|
|
16163
16168
|
const render = () => {
|
|
@@ -16177,6 +16182,7 @@ const Plugin = (five$1, params) => {
|
|
|
16177
16182
|
props: {
|
|
16178
16183
|
five: five$1,
|
|
16179
16184
|
modelOcclusionEnable: pluginState.modelOcclusionEnable,
|
|
16185
|
+
onlyVisibleInPanorama: pluginState.onlyVisibleInPanorama,
|
|
16180
16186
|
itemLabels: pluginState.itemLabels,
|
|
16181
16187
|
wrapper: pluginState.wrapper,
|
|
16182
16188
|
hooks: pluginState.hooks,
|
|
@@ -16194,9 +16200,27 @@ const Plugin = (five$1, params) => {
|
|
|
16194
16200
|
};
|
|
16195
16201
|
// 添加 five 监听
|
|
16196
16202
|
const addListener4Five = () => {
|
|
16197
|
-
|
|
16203
|
+
five$1.on('modeChange', onFiveModeChange);
|
|
16198
16204
|
five$1.once('dispose', dispose);
|
|
16199
16205
|
};
|
|
16206
|
+
// 取消 five 监听
|
|
16207
|
+
const removeListener4Five = () => {
|
|
16208
|
+
five$1.off('modeChange', onFiveModeChange);
|
|
16209
|
+
};
|
|
16210
|
+
const onFiveModeChange = (mode) => {
|
|
16211
|
+
// if (!pluginState.enabled) return
|
|
16212
|
+
if (mode !== five.Five.Mode.Panorama) {
|
|
16213
|
+
pluginState.fiveModeEnabled = false;
|
|
16214
|
+
disable();
|
|
16215
|
+
return;
|
|
16216
|
+
}
|
|
16217
|
+
// pluginState.fiveModeEnabled = false
|
|
16218
|
+
// render()
|
|
16219
|
+
five$1.once('initAnimationEnded', () => {
|
|
16220
|
+
pluginState.fiveModeEnabled = true;
|
|
16221
|
+
enable();
|
|
16222
|
+
});
|
|
16223
|
+
};
|
|
16200
16224
|
addListener4Five();
|
|
16201
16225
|
return {
|
|
16202
16226
|
appendTo,
|
|
@@ -16213,8 +16237,11 @@ const itemLabelPluginServerParams = {
|
|
|
16213
16237
|
version: 0,
|
|
16214
16238
|
};
|
|
16215
16239
|
|
|
16240
|
+
const DnalogelVersion = '2.0.0-alpha.38';
|
|
16241
|
+
|
|
16216
16242
|
exports.CSS3DRenderPlugin = CSS3DRenderPlugin;
|
|
16217
16243
|
exports.CameraMovementPlugin = CameraMovementPlugin;
|
|
16244
|
+
exports.DnalogelVersion = DnalogelVersion;
|
|
16218
16245
|
exports.FLOOR_TYPE_MAP = FLOOR_TYPE_MAP;
|
|
16219
16246
|
exports.ItemLabelPlugin = Plugin;
|
|
16220
16247
|
exports.Magnifier = Magnifier;
|
package/dist/index.umd.js
CHANGED
|
@@ -15589,18 +15589,18 @@ void main() {
|
|
|
15589
15589
|
|
|
15590
15590
|
function get_each_context(ctx, list, i) {
|
|
15591
15591
|
const child_ctx = ctx.slice();
|
|
15592
|
-
child_ctx[
|
|
15592
|
+
child_ctx[31] = list[i];
|
|
15593
15593
|
return child_ctx;
|
|
15594
15594
|
}
|
|
15595
15595
|
|
|
15596
|
-
// (
|
|
15596
|
+
// (235:2) {#if itemLabelItem.visible}
|
|
15597
15597
|
function create_if_block(ctx) {
|
|
15598
15598
|
let itemlabelitem;
|
|
15599
15599
|
let current;
|
|
15600
15600
|
|
|
15601
15601
|
itemlabelitem = new ItemLabelItem({
|
|
15602
15602
|
props: {
|
|
15603
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
15603
|
+
itemLabel: /*itemLabelItem*/ ctx[31],
|
|
15604
15604
|
hooks: /*hooks*/ ctx[0],
|
|
15605
15605
|
anchorEnabled: /*anchorEnabled*/ ctx[2],
|
|
15606
15606
|
onIconClick: /*onIconClick*/ ctx[6]
|
|
@@ -15617,7 +15617,7 @@ void main() {
|
|
|
15617
15617
|
},
|
|
15618
15618
|
p(ctx, dirty) {
|
|
15619
15619
|
const itemlabelitem_changes = {};
|
|
15620
|
-
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[
|
|
15620
|
+
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[31];
|
|
15621
15621
|
if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
15622
15622
|
if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
|
|
15623
15623
|
itemlabelitem.$set(itemlabelitem_changes);
|
|
@@ -15637,12 +15637,12 @@ void main() {
|
|
|
15637
15637
|
};
|
|
15638
15638
|
}
|
|
15639
15639
|
|
|
15640
|
-
// (
|
|
15640
|
+
// (234:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
15641
15641
|
function create_each_block(key_1, ctx) {
|
|
15642
15642
|
let first;
|
|
15643
15643
|
let if_block_anchor;
|
|
15644
15644
|
let current;
|
|
15645
|
-
let if_block = /*itemLabelItem*/ ctx[
|
|
15645
|
+
let if_block = /*itemLabelItem*/ ctx[31].visible && create_if_block(ctx);
|
|
15646
15646
|
|
|
15647
15647
|
return {
|
|
15648
15648
|
key: key_1,
|
|
@@ -15662,7 +15662,7 @@ void main() {
|
|
|
15662
15662
|
p(new_ctx, dirty) {
|
|
15663
15663
|
ctx = new_ctx;
|
|
15664
15664
|
|
|
15665
|
-
if (/*itemLabelItem*/ ctx[
|
|
15665
|
+
if (/*itemLabelItem*/ ctx[31].visible) {
|
|
15666
15666
|
if (if_block) {
|
|
15667
15667
|
if_block.p(ctx, dirty);
|
|
15668
15668
|
|
|
@@ -15709,7 +15709,7 @@ void main() {
|
|
|
15709
15709
|
let div_resize_listener;
|
|
15710
15710
|
let current;
|
|
15711
15711
|
let each_value = /*renderItemLabels*/ ctx[1];
|
|
15712
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
15712
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[31].id;
|
|
15713
15713
|
|
|
15714
15714
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
15715
15715
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -15726,7 +15726,7 @@ void main() {
|
|
|
15726
15726
|
}
|
|
15727
15727
|
|
|
15728
15728
|
internal.attr(div, "class", "item-labels-container svelte-gk8s47");
|
|
15729
|
-
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[
|
|
15729
|
+
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[13].call(div));
|
|
15730
15730
|
internal.set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
|
|
15731
15731
|
},
|
|
15732
15732
|
m(target, anchor) {
|
|
@@ -15736,7 +15736,7 @@ void main() {
|
|
|
15736
15736
|
each_blocks[i].m(div, null);
|
|
15737
15737
|
}
|
|
15738
15738
|
|
|
15739
|
-
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[
|
|
15739
|
+
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[13].bind(div));
|
|
15740
15740
|
current = true;
|
|
15741
15741
|
},
|
|
15742
15742
|
p(ctx, dirty) {
|
|
@@ -15784,6 +15784,7 @@ void main() {
|
|
|
15784
15784
|
const { Raycaster, Vector3 } = THREE__namespace;
|
|
15785
15785
|
let { five: five$1 } = $$props;
|
|
15786
15786
|
let { modelOcclusionEnable } = $$props;
|
|
15787
|
+
let { onlyVisibleInPanorama } = $$props;
|
|
15787
15788
|
let { itemLabels } = $$props;
|
|
15788
15789
|
let { hooks } = $$props;
|
|
15789
15790
|
let { displayStrategyType } = $$props;
|
|
@@ -15835,7 +15836,10 @@ void main() {
|
|
|
15835
15836
|
const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
|
|
15836
15837
|
const isFront = Math.abs(offsetZFromCenter) < 1;
|
|
15837
15838
|
const cssOffset = [ratioFromLeft, ratioFromTop];
|
|
15839
|
+
|
|
15840
|
+
// 只计算在前面就行
|
|
15838
15841
|
const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
|
|
15842
|
+
|
|
15839
15843
|
return Boolean(isInViewport);
|
|
15840
15844
|
};
|
|
15841
15845
|
|
|
@@ -15856,8 +15860,15 @@ void main() {
|
|
|
15856
15860
|
};
|
|
15857
15861
|
|
|
15858
15862
|
const getFormatedItemLabels = (five$1, labels) => {
|
|
15863
|
+
console.log(labels);
|
|
15864
|
+
|
|
15859
15865
|
// 计算位置 & 可见性
|
|
15860
15866
|
const newLabels = labels.map(label => {
|
|
15867
|
+
// 不在绑定点位则直接不可见
|
|
15868
|
+
if (five$1.state.panoIndex !== label.panoIndex) {
|
|
15869
|
+
return Object.assign(Object.assign({}, label), { visible: false });
|
|
15870
|
+
}
|
|
15871
|
+
|
|
15861
15872
|
const cssOffset = getLabelCssOffset(five$1, label);
|
|
15862
15873
|
label.name.length * basicWidth;
|
|
15863
15874
|
const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
|
|
@@ -15910,16 +15921,6 @@ void main() {
|
|
|
15910
15921
|
handleCameraUpdate();
|
|
15911
15922
|
};
|
|
15912
15923
|
|
|
15913
|
-
const onFiveModeChange = mode => {
|
|
15914
|
-
$$invalidate(5, itemsVisible = false);
|
|
15915
|
-
|
|
15916
|
-
five$1.once('initAnimationEnded', (panoIndex, pose, userAction) => {
|
|
15917
|
-
$$invalidate(2, anchorEnabled = mode === five.Five.Mode.Panorama);
|
|
15918
|
-
$$invalidate(5, itemsVisible = true);
|
|
15919
|
-
if (!userAction) return; else onItemLabelUpdate();
|
|
15920
|
-
});
|
|
15921
|
-
};
|
|
15922
|
-
|
|
15923
15924
|
const handleCameraUpdate = debounce(
|
|
15924
15925
|
() => {
|
|
15925
15926
|
$$invalidate(5, itemsVisible = true);
|
|
@@ -15977,11 +15978,10 @@ void main() {
|
|
|
15977
15978
|
const onIconClick = itemLabel => {
|
|
15978
15979
|
if (five$1.state.mode === five.Five.Mode.Panorama) return;
|
|
15979
15980
|
const observers = five$1.work.observers;
|
|
15980
|
-
const fromPositionVector = new Vector3(
|
|
15981
|
+
const fromPositionVector = new Vector3().fromArray(itemLabel.position);
|
|
15981
15982
|
const observer = getNearObserverPano(fromPositionVector, observers);
|
|
15982
15983
|
|
|
15983
15984
|
if (observer) {
|
|
15984
|
-
console.log('--has observer--');
|
|
15985
15985
|
itemLabel.observerIndex = observer.panoIndex;
|
|
15986
15986
|
}
|
|
15987
15987
|
|
|
@@ -16024,12 +16024,12 @@ void main() {
|
|
|
16024
16024
|
onItemLabelUpdate();
|
|
16025
16025
|
addResizeListener();
|
|
16026
16026
|
five$1.on('cameraUpdate', handleCameraUpdateCallback);
|
|
16027
|
-
|
|
16028
|
-
});
|
|
16027
|
+
}); // five.on('modeChange', onFiveModeChange)
|
|
16029
16028
|
|
|
16030
16029
|
svelte.onDestroy(() => {
|
|
16031
16030
|
five$1.off('cameraUpdate', handleCameraUpdateCallback);
|
|
16032
|
-
|
|
16031
|
+
|
|
16032
|
+
// five.off('modeChange', onFiveModeChange)
|
|
16033
16033
|
window.removeEventListener('resize', onResize, false);
|
|
16034
16034
|
});
|
|
16035
16035
|
|
|
@@ -16043,10 +16043,11 @@ void main() {
|
|
|
16043
16043
|
$$self.$$set = $$props => {
|
|
16044
16044
|
if ('five' in $$props) $$invalidate(7, five$1 = $$props.five);
|
|
16045
16045
|
if ('modelOcclusionEnable' in $$props) $$invalidate(8, modelOcclusionEnable = $$props.modelOcclusionEnable);
|
|
16046
|
-
if ('
|
|
16046
|
+
if ('onlyVisibleInPanorama' in $$props) $$invalidate(9, onlyVisibleInPanorama = $$props.onlyVisibleInPanorama);
|
|
16047
|
+
if ('itemLabels' in $$props) $$invalidate(10, itemLabels = $$props.itemLabels);
|
|
16047
16048
|
if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
|
|
16048
|
-
if ('displayStrategyType' in $$props) $$invalidate(
|
|
16049
|
-
if ('maxVisibleDistance' in $$props) $$invalidate(
|
|
16049
|
+
if ('displayStrategyType' in $$props) $$invalidate(11, displayStrategyType = $$props.displayStrategyType);
|
|
16050
|
+
if ('maxVisibleDistance' in $$props) $$invalidate(12, maxVisibleDistance = $$props.maxVisibleDistance);
|
|
16050
16051
|
};
|
|
16051
16052
|
|
|
16052
16053
|
return [
|
|
@@ -16059,6 +16060,7 @@ void main() {
|
|
|
16059
16060
|
onIconClick,
|
|
16060
16061
|
five$1,
|
|
16061
16062
|
modelOcclusionEnable,
|
|
16063
|
+
onlyVisibleInPanorama,
|
|
16062
16064
|
itemLabels,
|
|
16063
16065
|
displayStrategyType,
|
|
16064
16066
|
maxVisibleDistance,
|
|
@@ -16079,10 +16081,11 @@ void main() {
|
|
|
16079
16081
|
{
|
|
16080
16082
|
five: 7,
|
|
16081
16083
|
modelOcclusionEnable: 8,
|
|
16082
|
-
|
|
16084
|
+
onlyVisibleInPanorama: 9,
|
|
16085
|
+
itemLabels: 10,
|
|
16083
16086
|
hooks: 0,
|
|
16084
|
-
displayStrategyType:
|
|
16085
|
-
maxVisibleDistance:
|
|
16087
|
+
displayStrategyType: 11,
|
|
16088
|
+
maxVisibleDistance: 12
|
|
16086
16089
|
},
|
|
16087
16090
|
add_css,
|
|
16088
16091
|
[-1, -1]
|
|
@@ -16092,12 +16095,12 @@ void main() {
|
|
|
16092
16095
|
|
|
16093
16096
|
/** @description 转成内部所需数据 */
|
|
16094
16097
|
function parseItemLabelPluginData(data) {
|
|
16095
|
-
return data.item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined }
|
|
16098
|
+
return data.item_labels.map(label => (Object.assign(Object.assign({}, label), { modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined })));
|
|
16096
16099
|
}
|
|
16097
16100
|
|
|
16098
16101
|
const defaultMaxVisibleDistance = undefined;
|
|
16099
16102
|
const Plugin = (five$1, params) => {
|
|
16100
|
-
var _a, _b, _c;
|
|
16103
|
+
var _a, _b, _c, _d;
|
|
16101
16104
|
const pluginState = {
|
|
16102
16105
|
container: document.createElement('div'),
|
|
16103
16106
|
data: null,
|
|
@@ -16108,8 +16111,9 @@ void main() {
|
|
|
16108
16111
|
app: undefined,
|
|
16109
16112
|
hooks: new five.Subscribe(),
|
|
16110
16113
|
modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
|
|
16111
|
-
|
|
16112
|
-
|
|
16114
|
+
onlyVisibleInPanorama: (_b = params === null || params === void 0 ? void 0 : params.onlyVisibleInPanorama) !== null && _b !== void 0 ? _b : true,
|
|
16115
|
+
displayStrategyType: (_c = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _c !== void 0 ? _c : exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL,
|
|
16116
|
+
maxVisibleDistance: (_d = params === null || params === void 0 ? void 0 : params.maxVisibleDistance) !== null && _d !== void 0 ? _d : defaultMaxVisibleDistance,
|
|
16113
16117
|
};
|
|
16114
16118
|
pluginState.container.setAttribute('class', 'item-label-plugin-container');
|
|
16115
16119
|
pluginState.container.style.cssText = `
|
|
@@ -16146,6 +16150,7 @@ void main() {
|
|
|
16146
16150
|
return true;
|
|
16147
16151
|
};
|
|
16148
16152
|
const dispose = () => {
|
|
16153
|
+
removeListener4Five();
|
|
16149
16154
|
pluginState.container.remove();
|
|
16150
16155
|
};
|
|
16151
16156
|
const render = () => {
|
|
@@ -16165,6 +16170,7 @@ void main() {
|
|
|
16165
16170
|
props: {
|
|
16166
16171
|
five: five$1,
|
|
16167
16172
|
modelOcclusionEnable: pluginState.modelOcclusionEnable,
|
|
16173
|
+
onlyVisibleInPanorama: pluginState.onlyVisibleInPanorama,
|
|
16168
16174
|
itemLabels: pluginState.itemLabels,
|
|
16169
16175
|
wrapper: pluginState.wrapper,
|
|
16170
16176
|
hooks: pluginState.hooks,
|
|
@@ -16182,9 +16188,27 @@ void main() {
|
|
|
16182
16188
|
};
|
|
16183
16189
|
// 添加 five 监听
|
|
16184
16190
|
const addListener4Five = () => {
|
|
16185
|
-
|
|
16191
|
+
five$1.on('modeChange', onFiveModeChange);
|
|
16186
16192
|
five$1.once('dispose', dispose);
|
|
16187
16193
|
};
|
|
16194
|
+
// 取消 five 监听
|
|
16195
|
+
const removeListener4Five = () => {
|
|
16196
|
+
five$1.off('modeChange', onFiveModeChange);
|
|
16197
|
+
};
|
|
16198
|
+
const onFiveModeChange = (mode) => {
|
|
16199
|
+
// if (!pluginState.enabled) return
|
|
16200
|
+
if (mode !== five.Five.Mode.Panorama) {
|
|
16201
|
+
pluginState.fiveModeEnabled = false;
|
|
16202
|
+
disable();
|
|
16203
|
+
return;
|
|
16204
|
+
}
|
|
16205
|
+
// pluginState.fiveModeEnabled = false
|
|
16206
|
+
// render()
|
|
16207
|
+
five$1.once('initAnimationEnded', () => {
|
|
16208
|
+
pluginState.fiveModeEnabled = true;
|
|
16209
|
+
enable();
|
|
16210
|
+
});
|
|
16211
|
+
};
|
|
16188
16212
|
addListener4Five();
|
|
16189
16213
|
return {
|
|
16190
16214
|
appendTo,
|
|
@@ -16201,8 +16225,11 @@ void main() {
|
|
|
16201
16225
|
version: 0,
|
|
16202
16226
|
};
|
|
16203
16227
|
|
|
16228
|
+
const DnalogelVersion = '2.0.0-alpha.38';
|
|
16229
|
+
|
|
16204
16230
|
exports.CSS3DRenderPlugin = CSS3DRenderPlugin;
|
|
16205
16231
|
exports.CameraMovementPlugin = CameraMovementPlugin;
|
|
16232
|
+
exports.DnalogelVersion = DnalogelVersion;
|
|
16206
16233
|
exports.FLOOR_TYPE_MAP = FLOOR_TYPE_MAP;
|
|
16207
16234
|
exports.ItemLabelPlugin = Plugin;
|
|
16208
16235
|
exports.Magnifier = Magnifier;
|