@realsee/dnalogel 2.0.0-alpha.30-beta → 2.0.0-alpha.31
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 +7 -0
- package/dist/ItemLabelPlugin/index.js +398 -160
- package/dist/ItemLabelPlugin/typings.d.ts +5 -0
- package/dist/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
- package/dist/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
- package/dist/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
- package/dist/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
- package/dist/PanoMeasurePlugin/Controller/BaseController.d.ts +5 -2
- package/dist/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
- package/dist/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -0
- package/dist/PanoMeasurePlugin/Controller/index.d.ts +17 -8
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +3 -0
- package/dist/PanoMeasurePlugin/Modules/Magnifier.d.ts +49 -14
- package/dist/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/index.d.ts +4 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/style.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
- package/dist/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
- package/dist/PanoMeasurePlugin/index.d.ts +8 -5
- package/dist/PanoMeasurePlugin/index.js +1893 -3431
- package/dist/PanoMeasurePlugin/typings/data.d.ts +4 -0
- package/dist/PanoMeasurePlugin/typings/event.type.d.ts +10 -1
- package/dist/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
- package/dist/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -2
- package/dist/floorplan/ModelFloorplanPlugin/index.js +3 -3
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +3 -3
- package/dist/index.es.js +1865 -3186
- package/dist/index.js +1800 -3119
- package/dist/index.umd.js +1803 -3123
- package/dist/shared-utils/index.d.ts +1 -0
- package/dist/shared-utils/math/Interval.d.ts +13 -0
- package/dist/shared-utils/math/Rectangle.d.ts +27 -0
- package/dist/shared-utils/math/index.d.ts +2 -0
- package/docs/assets/search.js +1 -1
- package/docs/classes/Magnifier.html +9 -0
- package/docs/classes/ModelRoomLabelController.html +5 -5
- 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 +2 -2
- package/docs/interfaces/CSS3DRenderPluginExportType.html +3 -3
- package/docs/interfaces/CameraMovementPluginExportType.html +3 -3
- package/docs/interfaces/FloorplanBounding.html +5 -5
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +8 -8
- package/docs/interfaces/FloorplanExtraObject.html +4 -4
- 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 +7 -7
- package/docs/interfaces/FloorplanRoomLabelItem.html +4 -4
- package/docs/interfaces/FloorplanServerBounding.html +5 -5
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerEntrance.html +8 -8
- 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 +8 -8
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +4 -4
- 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 +3 -3
- 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 +3 -0
- 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 -0
- 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 +10 -10
- package/docs/modules.html +20 -20
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +242 -79
- package/libs/ItemLabelPlugin/ItemLabelItem.js +112 -58
- package/libs/ItemLabelPlugin/Plugin.js +7 -4
- package/libs/ItemLabelPlugin/typings.d.ts +5 -0
- package/libs/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
- package/libs/ItemLabelPlugin/utils/getLabelTransform.js +3 -0
- package/libs/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
- package/libs/ItemLabelPlugin/utils/getStrokeLength.js +16 -0
- package/libs/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
- package/libs/ItemLabelPlugin/utils/isImpacted.js +13 -0
- package/libs/ItemLabelPlugin/utils/parseData.js +1 -1
- package/libs/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
- package/libs/ItemLabelPlugin/utils/transform2RenderData.js +4 -0
- package/libs/PanoMeasurePlugin/Controller/BaseController.d.ts +5 -2
- package/libs/PanoMeasurePlugin/Controller/BaseController.js +9 -1
- package/libs/PanoMeasurePlugin/Controller/EditController.js +4 -4
- package/libs/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
- package/libs/PanoMeasurePlugin/Controller/MixedController.js +337 -0
- package/libs/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -0
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +14 -3
- package/libs/PanoMeasurePlugin/Controller/index.d.ts +17 -8
- package/libs/PanoMeasurePlugin/Controller/index.js +57 -18
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +11 -14
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +3 -0
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +48 -11
- package/libs/PanoMeasurePlugin/Modules/Magnifier.d.ts +49 -14
- package/libs/PanoMeasurePlugin/Modules/Magnifier.js +185 -60
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +1 -1
- package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.js +98 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/index.d.ts +4 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +24 -7
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.js +80 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/style.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/style.js +10 -1
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.js +64 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.js +265 -0
- package/libs/PanoMeasurePlugin/index.d.ts +8 -5
- package/libs/PanoMeasurePlugin/index.js +2 -0
- package/libs/PanoMeasurePlugin/typings/data.d.ts +4 -0
- package/libs/PanoMeasurePlugin/typings/event.type.d.ts +10 -1
- package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
- package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.js +15 -0
- package/libs/PanoMeasurePlugin/utils/constants.js +7 -7
- package/libs/PanoMeasurePlugin/utils/distanceDom.js +19 -14
- package/libs/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -2
- package/libs/PanoMeasurePlugin/utils/mouseGroup.js +5 -6
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +3 -3
- package/libs/shared-utils/index.d.ts +1 -0
- package/libs/shared-utils/index.js +1 -0
- package/libs/shared-utils/math/Interval.d.ts +13 -0
- package/libs/shared-utils/math/Interval.js +40 -0
- package/libs/shared-utils/math/Rectangle.d.ts +27 -0
- package/libs/shared-utils/math/Rectangle.js +50 -0
- package/libs/shared-utils/math/index.d.ts +2 -0
- package/libs/shared-utils/math/index.js +2 -0
- package/package.json +3 -2
|
@@ -42,151 +42,204 @@ exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE = void 0;
|
|
|
42
42
|
/* src/ItemLabelPlugin/ItemLabelItem.svelte generated by Svelte v3.47.0 */
|
|
43
43
|
|
|
44
44
|
function add_css$1(target) {
|
|
45
|
-
internal.append_styles(target, "svelte-
|
|
45
|
+
internal.append_styles(target, "svelte-4rvov0", ".item-label-item.svelte-4rvov0.svelte-4rvov0{position:absolute;z-index:0;transform:none;cursor:pointer;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-animation:svelte-4rvov0-fadeIn .3s ease-in;animation:svelte-4rvov0-fadeIn .3s ease-in}.item-label-item.fold.svelte-4rvov0>.item-label-item__text-wrap.svelte-4rvov0{visibility:hidden}.item-label-item.fold.svelte-4rvov0>.item-label-item__bar.anchor.svelte-4rvov0{visibility:hidden}.item-label-item.fold.svelte-4rvov0>.item-label-item__bar.anchor.svelte-4rvov0:after{visibility:visible}.item-label-item__text-wrap.svelte-4rvov0.svelte-4rvov0{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;padding:0.625rem 1.04167rem 0.625rem 0.625rem;position:absolute;width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:24.63542rem;min-height:4.79167rem;background-image:linear-gradient(269deg, rgba(0, 0, 0, 0.50) 0%, rgba(0, 0, 0, 0.60) 49%, rgba(31, 38, 46, 0.70) 100%);border:1.5px solid rgba(255, 255, 255, .65);border-radius:0.15625rem;color:white;transform:translate(-50%, 0);display:flex;justify-content:flex-start;align-items:center;box-sizing:border-box;overflow:hidden;pointer-events:all}.icon-wrap.svelte-4rvov0.svelte-4rvov0{width:3.54167rem;height:100%;display:flex;justify-content:center;align-content:center}.icon.svelte-4rvov0.svelte-4rvov0{width:3.54167rem;height:3.54167rem;background-repeat:no-repeat;background-size:contain;background-position:center}.item-label-text.svelte-4rvov0.svelte-4rvov0{margin-left:0.625rem;padding-left:0.625rem;min-height:3.54167rem;height:auto;display:flex;flex-flow:column;justify-content:space-around;align-content:flex-start;border-left:solid rgba(255, 255, 255, .2) 1px;border-top:solid rgba(255, 255, 255, .2) 0;border-right:solid rgba(255, 255, 255, .2) 0;border-bottom:solid rgba(255, 255, 255, .2) 0;pointer-events:auto}.item-model.svelte-4rvov0.svelte-4rvov0{white-space:nowrap;font-size:1.14583rem;font-weight:bold;line-height:1.5625rem}.item-name.svelte-4rvov0.svelte-4rvov0{height:auto;word-wrap:break-word;word-break:break-all;font-size:1.04167rem;line-height:1.45833rem}.item-label-item__bar.svelte-4rvov0.svelte-4rvov0{position:absolute;bottom:0;width:0.15625rem;background-image:linear-gradient(to bottom, white, rgba(255, 255, 255, 0));box-shadow:0 2px 0.41667rem 0 rgba(0, 0, 0, 0.20);pointer-events:none}.item-label-item__bar.anchor.svelte-4rvov0.svelte-4rvov0:after{content:'';position:absolute;bottom:0;width:1.25rem;height:1.25rem;background-image:url(\"//vrlab-public.ljcdn.com/common/file/web/67e7a198-28c9-47dc-879b-507bd3ae600c.png \");background-position:center;background-size:contain;transform:translate(-0.54688rem, 50%)}@-webkit-keyframes svelte-4rvov0-fadeIn{from{opacity:0\n }to{opacity:1\n }}@keyframes svelte-4rvov0-fadeIn{from{opacity:0\n }to{opacity:1\n }}");
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
let div3;
|
|
48
|
+
// (21:2) {#if itemLabel.icon}
|
|
49
|
+
function create_if_block$1(ctx) {
|
|
51
50
|
let div1;
|
|
52
51
|
let div0;
|
|
53
52
|
let div0_style_value;
|
|
53
|
+
let mounted;
|
|
54
|
+
let dispose;
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
c() {
|
|
58
|
+
div1 = internal.element("div");
|
|
59
|
+
div0 = internal.element("div");
|
|
60
|
+
internal.attr(div0, "class", "icon svelte-4rvov0");
|
|
61
|
+
internal.attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`);
|
|
62
|
+
internal.attr(div1, "class", "icon-wrap svelte-4rvov0");
|
|
63
|
+
},
|
|
64
|
+
m(target, anchor) {
|
|
65
|
+
internal.insert(target, div1, anchor);
|
|
66
|
+
internal.append(div1, div0);
|
|
67
|
+
|
|
68
|
+
if (!mounted) {
|
|
69
|
+
dispose = internal.listen(div1, "click", /*click_handler*/ ctx[5]);
|
|
70
|
+
mounted = true;
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
p(ctx, dirty) {
|
|
74
|
+
if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`)) {
|
|
75
|
+
internal.attr(div0, "style", div0_style_value);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
d(detaching) {
|
|
79
|
+
if (detaching) internal.detach(div1);
|
|
80
|
+
mounted = false;
|
|
81
|
+
dispose();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function create_fragment$1(ctx) {
|
|
87
|
+
let div3;
|
|
88
|
+
let div1;
|
|
54
89
|
let t0;
|
|
55
|
-
let
|
|
90
|
+
let div0;
|
|
56
91
|
let span0;
|
|
57
|
-
let t1_value = (/*itemLabel*/ ctx[0].code
|
|
92
|
+
let t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "";
|
|
58
93
|
let t1;
|
|
59
94
|
let t2;
|
|
60
95
|
let span1;
|
|
61
96
|
let t3_value = /*itemLabel*/ ctx[0].name + "";
|
|
62
97
|
let t3;
|
|
63
|
-
let div3_class_value;
|
|
64
98
|
let t4;
|
|
65
|
-
let
|
|
66
|
-
let
|
|
67
|
-
let
|
|
99
|
+
let div2;
|
|
100
|
+
let div2_class_value;
|
|
101
|
+
let div3_class_value;
|
|
68
102
|
let mounted;
|
|
69
103
|
let dispose;
|
|
104
|
+
let if_block = /*itemLabel*/ ctx[0].icon && create_if_block$1(ctx);
|
|
70
105
|
|
|
71
106
|
return {
|
|
72
107
|
c() {
|
|
73
|
-
div5 = internal.element("div");
|
|
74
108
|
div3 = internal.element("div");
|
|
75
109
|
div1 = internal.element("div");
|
|
76
|
-
|
|
110
|
+
if (if_block) if_block.c();
|
|
77
111
|
t0 = internal.space();
|
|
78
|
-
|
|
112
|
+
div0 = internal.element("div");
|
|
79
113
|
span0 = internal.element("span");
|
|
80
114
|
t1 = internal.text(t1_value);
|
|
81
115
|
t2 = internal.space();
|
|
82
116
|
span1 = internal.element("span");
|
|
83
117
|
t3 = internal.text(t3_value);
|
|
84
118
|
t4 = internal.space();
|
|
85
|
-
|
|
86
|
-
internal.attr(
|
|
87
|
-
internal.attr(
|
|
88
|
-
internal.attr(
|
|
89
|
-
internal.attr(
|
|
90
|
-
internal.
|
|
91
|
-
internal.attr(div2, "class", "item-label-
|
|
92
|
-
internal.
|
|
93
|
-
internal.
|
|
94
|
-
internal.
|
|
95
|
-
internal.set_style(
|
|
96
|
-
internal.attr(div5, "class", div5_class_value = "" + (internal.null_to_empty(classNames__default["default"]("item-label-item", { visible: /*itemLabel*/ ctx[0].visible })) + " svelte-1s5p8g"));
|
|
97
|
-
internal.set_style(div5, "z-index", /*itemLabel*/ ctx[0].zIndex, false);
|
|
98
|
-
internal.set_style(div5, "transform", /*itemLabel*/ ctx[0].transform, false);
|
|
119
|
+
div2 = internal.element("div");
|
|
120
|
+
internal.attr(span0, "class", "item-model svelte-4rvov0");
|
|
121
|
+
internal.attr(span1, "class", "item-name svelte-4rvov0");
|
|
122
|
+
internal.attr(div0, "class", "item-label-text svelte-4rvov0");
|
|
123
|
+
internal.attr(div1, "class", "" + (internal.null_to_empty(classNames__default["default"]("item-label-item__text-wrap")) + " svelte-4rvov0"));
|
|
124
|
+
internal.set_style(div1, "bottom", `${/*itemLabel*/ ctx[0].strokeLength}px`);
|
|
125
|
+
internal.attr(div2, "class", div2_class_value = "" + (internal.null_to_empty(classNames__default["default"]("item-label-item__bar", { anchor: /*anchorEnabled*/ ctx[1] })) + " svelte-4rvov0"));
|
|
126
|
+
internal.set_style(div2, "height", `${/*itemLabel*/ ctx[0].strokeLength}px`);
|
|
127
|
+
internal.attr(div3, "class", div3_class_value = "" + (internal.null_to_empty(classNames__default["default"]("item-label-item", { fold: /*itemLabel*/ ctx[0].isFold })) + " svelte-4rvov0"));
|
|
128
|
+
internal.set_style(div3, "z-index", /*itemLabel*/ ctx[0].zIndex, false);
|
|
129
|
+
internal.set_style(div3, "transform", /*itemLabel*/ ctx[0].transform, false);
|
|
99
130
|
},
|
|
100
131
|
m(target, anchor) {
|
|
101
|
-
internal.insert(target,
|
|
102
|
-
internal.append(div5, div3);
|
|
132
|
+
internal.insert(target, div3, anchor);
|
|
103
133
|
internal.append(div3, div1);
|
|
134
|
+
if (if_block) if_block.m(div1, null);
|
|
135
|
+
internal.append(div1, t0);
|
|
104
136
|
internal.append(div1, div0);
|
|
105
|
-
internal.append(
|
|
106
|
-
internal.append(div3, div2);
|
|
107
|
-
internal.append(div2, span0);
|
|
137
|
+
internal.append(div0, span0);
|
|
108
138
|
internal.append(span0, t1);
|
|
109
|
-
internal.append(
|
|
110
|
-
internal.append(
|
|
139
|
+
internal.append(div0, t2);
|
|
140
|
+
internal.append(div0, span1);
|
|
111
141
|
internal.append(span1, t3);
|
|
112
|
-
internal.append(
|
|
113
|
-
internal.append(
|
|
142
|
+
internal.append(div3, t4);
|
|
143
|
+
internal.append(div3, div2);
|
|
114
144
|
|
|
115
145
|
if (!mounted) {
|
|
116
|
-
dispose = internal.listen(
|
|
146
|
+
dispose = internal.listen(div1, "click", /*onClick*/ ctx[3]);
|
|
117
147
|
mounted = true;
|
|
118
148
|
}
|
|
119
149
|
},
|
|
120
150
|
p(ctx, [dirty]) {
|
|
121
|
-
if (
|
|
122
|
-
|
|
151
|
+
if (/*itemLabel*/ ctx[0].icon) {
|
|
152
|
+
if (if_block) {
|
|
153
|
+
if_block.p(ctx, dirty);
|
|
154
|
+
} else {
|
|
155
|
+
if_block = create_if_block$1(ctx);
|
|
156
|
+
if_block.c();
|
|
157
|
+
if_block.m(div1, t0);
|
|
158
|
+
}
|
|
159
|
+
} else if (if_block) {
|
|
160
|
+
if_block.d(1);
|
|
161
|
+
if_block = null;
|
|
123
162
|
}
|
|
124
163
|
|
|
125
|
-
if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code
|
|
164
|
+
if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "")) internal.set_data(t1, t1_value);
|
|
126
165
|
if (dirty & /*itemLabel*/ 1 && t3_value !== (t3_value = /*itemLabel*/ ctx[0].name + "")) internal.set_data(t3, t3_value);
|
|
127
166
|
|
|
128
|
-
if (dirty & /*itemLabel*/ 1 && div3_class_value !== (div3_class_value = "" + (internal.null_to_empty(classNames__default["default"]("item-label-item__text-wrap", { visible: /*itemLabel*/ ctx[0].visible })) + " svelte-1s5p8g"))) {
|
|
129
|
-
internal.attr(div3, "class", div3_class_value);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
167
|
if (dirty & /*itemLabel*/ 1) {
|
|
133
|
-
internal.set_style(
|
|
168
|
+
internal.set_style(div1, "bottom", `${/*itemLabel*/ ctx[0].strokeLength}px`);
|
|
134
169
|
}
|
|
135
170
|
|
|
136
|
-
if (dirty & /*anchorEnabled*/ 2 &&
|
|
137
|
-
internal.attr(
|
|
171
|
+
if (dirty & /*anchorEnabled*/ 2 && div2_class_value !== (div2_class_value = "" + (internal.null_to_empty(classNames__default["default"]("item-label-item__bar", { anchor: /*anchorEnabled*/ ctx[1] })) + " svelte-4rvov0"))) {
|
|
172
|
+
internal.attr(div2, "class", div2_class_value);
|
|
138
173
|
}
|
|
139
174
|
|
|
140
175
|
if (dirty & /*itemLabel*/ 1) {
|
|
141
|
-
internal.set_style(
|
|
176
|
+
internal.set_style(div2, "height", `${/*itemLabel*/ ctx[0].strokeLength}px`);
|
|
142
177
|
}
|
|
143
178
|
|
|
144
|
-
if (dirty & /*itemLabel*/ 1 &&
|
|
145
|
-
internal.attr(
|
|
179
|
+
if (dirty & /*itemLabel*/ 1 && div3_class_value !== (div3_class_value = "" + (internal.null_to_empty(classNames__default["default"]("item-label-item", { fold: /*itemLabel*/ ctx[0].isFold })) + " svelte-4rvov0"))) {
|
|
180
|
+
internal.attr(div3, "class", div3_class_value);
|
|
146
181
|
}
|
|
147
182
|
|
|
148
183
|
if (dirty & /*itemLabel*/ 1) {
|
|
149
|
-
internal.set_style(
|
|
184
|
+
internal.set_style(div3, "z-index", /*itemLabel*/ ctx[0].zIndex, false);
|
|
150
185
|
}
|
|
151
186
|
|
|
152
187
|
if (dirty & /*itemLabel*/ 1) {
|
|
153
|
-
internal.set_style(
|
|
188
|
+
internal.set_style(div3, "transform", /*itemLabel*/ ctx[0].transform, false);
|
|
154
189
|
}
|
|
155
190
|
},
|
|
156
191
|
i: internal.noop,
|
|
157
192
|
o: internal.noop,
|
|
158
193
|
d(detaching) {
|
|
159
|
-
if (detaching) internal.detach(
|
|
194
|
+
if (detaching) internal.detach(div3);
|
|
195
|
+
if (if_block) if_block.d();
|
|
160
196
|
mounted = false;
|
|
161
197
|
dispose();
|
|
162
198
|
}
|
|
163
199
|
};
|
|
164
200
|
}
|
|
165
201
|
|
|
166
|
-
const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n';
|
|
167
|
-
|
|
168
202
|
function instance$1($$self, $$props, $$invalidate) {
|
|
169
203
|
let { itemLabel } = $$props;
|
|
170
204
|
let { hooks } = $$props;
|
|
171
205
|
let { anchorEnabled } = $$props;
|
|
206
|
+
let { onIconClick } = $$props;
|
|
172
207
|
|
|
208
|
+
// const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n'
|
|
173
209
|
function onClick() {
|
|
174
210
|
hooks.emit('onLabelClick', itemLabel);
|
|
175
211
|
}
|
|
176
212
|
|
|
213
|
+
const click_handler = e => onIconClick(itemLabel);
|
|
214
|
+
|
|
177
215
|
$$self.$$set = $$props => {
|
|
178
216
|
if ('itemLabel' in $$props) $$invalidate(0, itemLabel = $$props.itemLabel);
|
|
179
|
-
if ('hooks' in $$props) $$invalidate(
|
|
217
|
+
if ('hooks' in $$props) $$invalidate(4, hooks = $$props.hooks);
|
|
180
218
|
if ('anchorEnabled' in $$props) $$invalidate(1, anchorEnabled = $$props.anchorEnabled);
|
|
219
|
+
if ('onIconClick' in $$props) $$invalidate(2, onIconClick = $$props.onIconClick);
|
|
181
220
|
};
|
|
182
221
|
|
|
183
|
-
return [itemLabel, anchorEnabled, onClick, hooks];
|
|
222
|
+
return [itemLabel, anchorEnabled, onIconClick, onClick, hooks, click_handler];
|
|
184
223
|
}
|
|
185
224
|
|
|
186
225
|
class ItemLabelItem extends internal.SvelteComponent {
|
|
187
226
|
constructor(options) {
|
|
188
227
|
super();
|
|
189
|
-
|
|
228
|
+
|
|
229
|
+
internal.init(
|
|
230
|
+
this,
|
|
231
|
+
options,
|
|
232
|
+
instance$1,
|
|
233
|
+
create_fragment$1,
|
|
234
|
+
internal.safe_not_equal,
|
|
235
|
+
{
|
|
236
|
+
itemLabel: 0,
|
|
237
|
+
hooks: 4,
|
|
238
|
+
anchorEnabled: 1,
|
|
239
|
+
onIconClick: 2
|
|
240
|
+
},
|
|
241
|
+
add_css$1
|
|
242
|
+
);
|
|
190
243
|
}
|
|
191
244
|
}
|
|
192
245
|
|
|
@@ -205,6 +258,44 @@ function debounce(func, wait = 200) {
|
|
|
205
258
|
};
|
|
206
259
|
}
|
|
207
260
|
|
|
261
|
+
const { Raycaster, Vector3 } = THREE__namespace;
|
|
262
|
+
/**
|
|
263
|
+
* 碰撞检测可见性
|
|
264
|
+
* */
|
|
265
|
+
const isImpacted = (five, sourceVector, targetVector, distance) => {
|
|
266
|
+
const direction = sourceVector.clone().sub(targetVector).normalize();
|
|
267
|
+
const raycaster = new Raycaster();
|
|
268
|
+
raycaster.set(targetVector, direction);
|
|
269
|
+
const [intersection] = five.model.intersectRaycaster(raycaster);
|
|
270
|
+
return intersection && intersection.distance + 0.01 < distance;
|
|
271
|
+
// return intersection && distance <= intersection.distance + 0.1
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* 展示策略
|
|
276
|
+
* */
|
|
277
|
+
const getStrokeLength = (itemSpaceHeight, type) => {
|
|
278
|
+
switch (type) {
|
|
279
|
+
case exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL:
|
|
280
|
+
return Math.ceil(-27.78 * itemSpaceHeight + 85);
|
|
281
|
+
case exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.MIDLLE:
|
|
282
|
+
return Math.ceil(-38.9 * itemSpaceHeight + 130);
|
|
283
|
+
case exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.LARGE:
|
|
284
|
+
return Math.ceil(-44.44 * itemSpaceHeight + 140);
|
|
285
|
+
case exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.EXTRA_LARGE:
|
|
286
|
+
return Math.ceil(-92.59 * itemSpaceHeight + 300);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
const getLabelTransform = (cssOffset) => {
|
|
291
|
+
return `translate(${cssOffset[0]}px, ${cssOffset[1]}px)`;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
/** @description 转成内部所需数据 */
|
|
295
|
+
function transform2RenderData(data) {
|
|
296
|
+
return data.map(label => (Object.assign({ observerIndex: undefined, visible: false, isFold: false }, label)));
|
|
297
|
+
}
|
|
298
|
+
|
|
208
299
|
/* src/ItemLabelPlugin/ItemLabelComponent.svelte generated by Svelte v3.47.0 */
|
|
209
300
|
|
|
210
301
|
function add_css(target) {
|
|
@@ -213,57 +304,115 @@ function add_css(target) {
|
|
|
213
304
|
|
|
214
305
|
function get_each_context(ctx, list, i) {
|
|
215
306
|
const child_ctx = ctx.slice();
|
|
216
|
-
child_ctx[
|
|
307
|
+
child_ctx[32] = list[i];
|
|
217
308
|
return child_ctx;
|
|
218
309
|
}
|
|
219
310
|
|
|
220
|
-
// (
|
|
221
|
-
function
|
|
222
|
-
let first;
|
|
311
|
+
// (248:2) {#if itemLabelItem.visible}
|
|
312
|
+
function create_if_block(ctx) {
|
|
223
313
|
let itemlabelitem;
|
|
224
314
|
let current;
|
|
225
315
|
|
|
226
316
|
itemlabelitem = new ItemLabelItem({
|
|
227
317
|
props: {
|
|
228
|
-
itemLabel: /*itemLabelItem*/ ctx[
|
|
229
|
-
hooks: /*hooks*/ ctx[
|
|
230
|
-
anchorEnabled: /*
|
|
318
|
+
itemLabel: /*itemLabelItem*/ ctx[32],
|
|
319
|
+
hooks: /*hooks*/ ctx[0],
|
|
320
|
+
anchorEnabled: /*anchorEnabled*/ ctx[2],
|
|
321
|
+
onIconClick: /*onIconClick*/ ctx[6]
|
|
231
322
|
}
|
|
232
323
|
});
|
|
233
324
|
|
|
325
|
+
return {
|
|
326
|
+
c() {
|
|
327
|
+
internal.create_component(itemlabelitem.$$.fragment);
|
|
328
|
+
},
|
|
329
|
+
m(target, anchor) {
|
|
330
|
+
internal.mount_component(itemlabelitem, target, anchor);
|
|
331
|
+
current = true;
|
|
332
|
+
},
|
|
333
|
+
p(ctx, dirty) {
|
|
334
|
+
const itemlabelitem_changes = {};
|
|
335
|
+
if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[32];
|
|
336
|
+
if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
|
|
337
|
+
if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
|
|
338
|
+
itemlabelitem.$set(itemlabelitem_changes);
|
|
339
|
+
},
|
|
340
|
+
i(local) {
|
|
341
|
+
if (current) return;
|
|
342
|
+
internal.transition_in(itemlabelitem.$$.fragment, local);
|
|
343
|
+
current = true;
|
|
344
|
+
},
|
|
345
|
+
o(local) {
|
|
346
|
+
internal.transition_out(itemlabelitem.$$.fragment, local);
|
|
347
|
+
current = false;
|
|
348
|
+
},
|
|
349
|
+
d(detaching) {
|
|
350
|
+
internal.destroy_component(itemlabelitem, detaching);
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// (247:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
|
|
356
|
+
function create_each_block(key_1, ctx) {
|
|
357
|
+
let first;
|
|
358
|
+
let if_block_anchor;
|
|
359
|
+
let current;
|
|
360
|
+
let if_block = /*itemLabelItem*/ ctx[32].visible && create_if_block(ctx);
|
|
361
|
+
|
|
234
362
|
return {
|
|
235
363
|
key: key_1,
|
|
236
364
|
first: null,
|
|
237
365
|
c() {
|
|
238
366
|
first = internal.empty();
|
|
239
|
-
|
|
367
|
+
if (if_block) if_block.c();
|
|
368
|
+
if_block_anchor = internal.empty();
|
|
240
369
|
this.first = first;
|
|
241
370
|
},
|
|
242
371
|
m(target, anchor) {
|
|
243
372
|
internal.insert(target, first, anchor);
|
|
244
|
-
|
|
373
|
+
if (if_block) if_block.m(target, anchor);
|
|
374
|
+
internal.insert(target, if_block_anchor, anchor);
|
|
245
375
|
current = true;
|
|
246
376
|
},
|
|
247
377
|
p(new_ctx, dirty) {
|
|
248
378
|
ctx = new_ctx;
|
|
249
|
-
|
|
250
|
-
if (
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
379
|
+
|
|
380
|
+
if (/*itemLabelItem*/ ctx[32].visible) {
|
|
381
|
+
if (if_block) {
|
|
382
|
+
if_block.p(ctx, dirty);
|
|
383
|
+
|
|
384
|
+
if (dirty[0] & /*renderItemLabels*/ 2) {
|
|
385
|
+
internal.transition_in(if_block, 1);
|
|
386
|
+
}
|
|
387
|
+
} else {
|
|
388
|
+
if_block = create_if_block(ctx);
|
|
389
|
+
if_block.c();
|
|
390
|
+
internal.transition_in(if_block, 1);
|
|
391
|
+
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
392
|
+
}
|
|
393
|
+
} else if (if_block) {
|
|
394
|
+
internal.group_outros();
|
|
395
|
+
|
|
396
|
+
internal.transition_out(if_block, 1, 1, () => {
|
|
397
|
+
if_block = null;
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
internal.check_outros();
|
|
401
|
+
}
|
|
254
402
|
},
|
|
255
403
|
i(local) {
|
|
256
404
|
if (current) return;
|
|
257
|
-
internal.transition_in(
|
|
405
|
+
internal.transition_in(if_block);
|
|
258
406
|
current = true;
|
|
259
407
|
},
|
|
260
408
|
o(local) {
|
|
261
|
-
internal.transition_out(
|
|
409
|
+
internal.transition_out(if_block);
|
|
262
410
|
current = false;
|
|
263
411
|
},
|
|
264
412
|
d(detaching) {
|
|
265
413
|
if (detaching) internal.detach(first);
|
|
266
|
-
|
|
414
|
+
if (if_block) if_block.d(detaching);
|
|
415
|
+
if (detaching) internal.detach(if_block_anchor);
|
|
267
416
|
}
|
|
268
417
|
};
|
|
269
418
|
}
|
|
@@ -274,8 +423,8 @@ function create_fragment(ctx) {
|
|
|
274
423
|
let each_1_lookup = new Map();
|
|
275
424
|
let div_resize_listener;
|
|
276
425
|
let current;
|
|
277
|
-
let each_value = /*renderItemLabels*/ ctx[
|
|
278
|
-
const get_key = ctx => /*itemLabelItem*/ ctx[
|
|
426
|
+
let each_value = /*renderItemLabels*/ ctx[1];
|
|
427
|
+
const get_key = ctx => /*itemLabelItem*/ ctx[32].id;
|
|
279
428
|
|
|
280
429
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
281
430
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -292,7 +441,7 @@ function create_fragment(ctx) {
|
|
|
292
441
|
}
|
|
293
442
|
|
|
294
443
|
internal.attr(div, "class", "item-labels-container svelte-gk8s47");
|
|
295
|
-
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[
|
|
444
|
+
internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[13].call(div));
|
|
296
445
|
internal.set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
|
|
297
446
|
},
|
|
298
447
|
m(target, anchor) {
|
|
@@ -302,18 +451,18 @@ function create_fragment(ctx) {
|
|
|
302
451
|
each_blocks[i].m(div, null);
|
|
303
452
|
}
|
|
304
453
|
|
|
305
|
-
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[
|
|
454
|
+
div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[13].bind(div));
|
|
306
455
|
current = true;
|
|
307
456
|
},
|
|
308
|
-
p(ctx,
|
|
309
|
-
if (dirty & /*renderItemLabels, hooks,
|
|
310
|
-
each_value = /*renderItemLabels*/ ctx[
|
|
457
|
+
p(ctx, dirty) {
|
|
458
|
+
if (dirty[0] & /*renderItemLabels, hooks, anchorEnabled, onIconClick*/ 71) {
|
|
459
|
+
each_value = /*renderItemLabels*/ ctx[1];
|
|
311
460
|
internal.group_outros();
|
|
312
461
|
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);
|
|
313
462
|
internal.check_outros();
|
|
314
463
|
}
|
|
315
464
|
|
|
316
|
-
if (dirty & /*itemsVisible*/ 32) {
|
|
465
|
+
if (dirty[0] & /*itemsVisible*/ 32) {
|
|
317
466
|
internal.set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
|
|
318
467
|
}
|
|
319
468
|
},
|
|
@@ -348,14 +497,20 @@ let basicWidth = 11;
|
|
|
348
497
|
|
|
349
498
|
function instance($$self, $$props, $$invalidate) {
|
|
350
499
|
const { Raycaster, Vector3 } = THREE__namespace;
|
|
351
|
-
let { five } = $$props;
|
|
500
|
+
let { five: five$1 } = $$props;
|
|
352
501
|
let { modelOcclusionEnable } = $$props;
|
|
353
502
|
let { itemLabels } = $$props;
|
|
354
503
|
let { wrapper } = $$props;
|
|
355
504
|
let { hooks } = $$props;
|
|
356
505
|
let { displayStrategyType } = $$props;
|
|
506
|
+
let { maxVisibleDistance } = $$props;
|
|
357
507
|
let curItemLabels = null;
|
|
358
508
|
let renderItemLabels = null;
|
|
509
|
+
|
|
510
|
+
let anchorEnabled = (five$1 === null || five$1 === void 0
|
|
511
|
+
? void 0
|
|
512
|
+
: five$1.currentMode) === five.Five.Mode.Panorama;
|
|
513
|
+
|
|
359
514
|
let wrapperSize = { width: 0, height: 0 };
|
|
360
515
|
let containerWidth;
|
|
361
516
|
let containerHeight;
|
|
@@ -371,19 +526,36 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
371
526
|
* 1、当前楼层(假设先不考虑多楼层)
|
|
372
527
|
* 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
|
|
373
528
|
* */
|
|
374
|
-
const
|
|
529
|
+
const judgeImpacted = (five$1, itemLabel) => {
|
|
375
530
|
// 虚拟 VR 仅有一层,不考虑楼层信息
|
|
376
|
-
const
|
|
531
|
+
const cameraPosition = five$1.camera.position.clone();
|
|
377
532
|
|
|
378
|
-
const cameraPosition = five.camera.position.clone();
|
|
379
533
|
const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
|
|
380
534
|
|
|
381
535
|
// 计算点到相机的位置
|
|
382
536
|
const vectorDistance = modelPosition.distanceTo(cameraPosition);
|
|
383
537
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
538
|
+
// 判断距离,大于最大可见距离直接不可见 TODO 把距离计算和碰撞拆分开
|
|
539
|
+
if (maxVisibleDistance !== undefined && five$1.state.mode === five.Five.Mode.Panorama) {
|
|
540
|
+
if (vectorDistance > maxVisibleDistance) {
|
|
541
|
+
return false;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
return isImpacted(five$1, modelPosition.clone().sub(cameraPosition).normalize(), cameraPosition, vectorDistance);
|
|
546
|
+
}; // raycaster.set(cameraPosition.clone(), modelPosition.clone().sub(cameraPosition).normalize())
|
|
547
|
+
// const [intersection] = five.model.intersectRaycaster(raycaster)
|
|
548
|
+
// return !(intersection && intersection.distance + 1 < vectorDistance);
|
|
549
|
+
|
|
550
|
+
const judgeInViewport = modelPoint => {
|
|
551
|
+
const { camera, model } = five$1;
|
|
552
|
+
const { x: offsetXFromCenter, y: offsetYFromCenter, z: offsetZFromCenter } = modelPoint.clone().project(camera);
|
|
553
|
+
const ratioFromLeft = (offsetXFromCenter + 1) / 2;
|
|
554
|
+
const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
|
|
555
|
+
const isFront = Math.abs(offsetZFromCenter) < 1;
|
|
556
|
+
const cssOffset = [ratioFromLeft, ratioFromTop];
|
|
557
|
+
const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
|
|
558
|
+
return Boolean(isInViewport);
|
|
387
559
|
};
|
|
388
560
|
|
|
389
561
|
// cssOffset 获取
|
|
@@ -402,36 +574,26 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
402
574
|
return [xOffset, yOffset];
|
|
403
575
|
};
|
|
404
576
|
|
|
405
|
-
const
|
|
406
|
-
return `translate(${cssOffset[0]}px, ${cssOffset[1]}px)`;
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
function getStrokeLength(itemSpaceHeight, type) {
|
|
410
|
-
switch (type) {
|
|
411
|
-
case exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL:
|
|
412
|
-
return Math.ceil(-27.78 * itemSpaceHeight + 85);
|
|
413
|
-
case exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.MIDLLE:
|
|
414
|
-
return Math.ceil(-38.9 * itemSpaceHeight + 130);
|
|
415
|
-
case exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.LARGE:
|
|
416
|
-
return Math.ceil(-44.44 * itemSpaceHeight + 140);
|
|
417
|
-
case exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.EXTRA_LARGE:
|
|
418
|
-
return Math.ceil(-92.59 * itemSpaceHeight + 300);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
const getFormatedItemLabels = (five, labels) => {
|
|
577
|
+
const getFormatedItemLabels = (five$1, labels) => {
|
|
423
578
|
// 计算位置 & 可见性
|
|
424
579
|
const newLabels = labels.map(label => {
|
|
425
|
-
const cssOffset = getLabelCssOffset(five, label);
|
|
580
|
+
const cssOffset = getLabelCssOffset(five$1, label);
|
|
426
581
|
label.name.length * basicWidth;
|
|
427
582
|
const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
|
|
428
583
|
|
|
429
584
|
// 是否加入碰撞检测
|
|
430
|
-
|
|
431
|
-
|
|
585
|
+
// 配置加入碰撞检测,则判断碰撞检测
|
|
586
|
+
// 在可见范围内, 仅在 Panorama 模态计算
|
|
587
|
+
const isInViewport = five$1.currentMode === five.Five.Mode.Panorama
|
|
588
|
+
? judgeInViewport(new Vector3(label.position[0], label.position[1], label.position[2]))
|
|
432
589
|
: true;
|
|
433
590
|
|
|
434
|
-
|
|
591
|
+
// 碰撞
|
|
592
|
+
const isBlocked = modelOcclusionEnable
|
|
593
|
+
? judgeImpacted(five$1, label)
|
|
594
|
+
: false;
|
|
595
|
+
|
|
596
|
+
const visible = isInViewport && !isBlocked;
|
|
435
597
|
|
|
436
598
|
// 关掉重叠计算
|
|
437
599
|
// const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth)
|
|
@@ -447,7 +609,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
447
609
|
|
|
448
610
|
const sortedItemLabelItems = newLabels.filter(({ visible }) => visible).map(label => ({
|
|
449
611
|
itemLabelItem: label,
|
|
450
|
-
distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five.camera.position)
|
|
612
|
+
distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five$1.camera.position)
|
|
451
613
|
})).sort((a, b) => a.distance - b.distance);
|
|
452
614
|
|
|
453
615
|
return newLabels.map(label => {
|
|
@@ -459,25 +621,23 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
459
621
|
|
|
460
622
|
const onItemLabelUpdate = () => {
|
|
461
623
|
cssOffsetLists = [];
|
|
462
|
-
$$invalidate(
|
|
624
|
+
$$invalidate(1, renderItemLabels = getFormatedItemLabels(five$1, renderItemLabels));
|
|
463
625
|
};
|
|
464
626
|
|
|
465
|
-
svelte.beforeUpdate(() => {
|
|
466
|
-
addDataUpdateListener();
|
|
467
|
-
});
|
|
468
|
-
|
|
469
627
|
const handleCameraUpdateCallback = () => {
|
|
470
628
|
$$invalidate(5, itemsVisible = false);
|
|
471
629
|
handleCameraUpdate();
|
|
472
630
|
};
|
|
473
631
|
|
|
474
|
-
|
|
475
|
-
$$invalidate(
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
632
|
+
const onFiveModeChange = mode => {
|
|
633
|
+
$$invalidate(5, itemsVisible = false);
|
|
634
|
+
|
|
635
|
+
five$1.once('initAnimationEnded', (panoIndex, pose, userAction) => {
|
|
636
|
+
$$invalidate(2, anchorEnabled = mode === five.Five.Mode.Panorama);
|
|
637
|
+
$$invalidate(5, itemsVisible = true);
|
|
638
|
+
if (!userAction) return; else onItemLabelUpdate();
|
|
639
|
+
});
|
|
640
|
+
};
|
|
481
641
|
|
|
482
642
|
const handleCameraUpdate = debounce(
|
|
483
643
|
() => {
|
|
@@ -498,7 +658,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
498
658
|
|
|
499
659
|
const addDataUpdateListener = () => {
|
|
500
660
|
if (curItemLabels !== itemLabels) {
|
|
501
|
-
$$invalidate(
|
|
661
|
+
$$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
|
|
502
662
|
curItemLabels = itemLabels;
|
|
503
663
|
onItemLabelUpdate();
|
|
504
664
|
}
|
|
@@ -516,8 +676,92 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
516
676
|
}
|
|
517
677
|
});
|
|
518
678
|
|
|
679
|
+
const getNearObserverPano = (fromPositionVector, observers) => {
|
|
680
|
+
let candidates = [];
|
|
681
|
+
|
|
682
|
+
for (let i = 0; i < observers.length; i++) {
|
|
683
|
+
const { position: obVector, panoIndex } = observers[i];
|
|
684
|
+
const distance = fromPositionVector.distanceTo(obVector);
|
|
685
|
+
|
|
686
|
+
if (maxVisibleDistance === undefined || distance <= maxVisibleDistance || five$1.state.mode !== five.Five.Mode.Panorama) {
|
|
687
|
+
candidates.push({ panoIndex, obVector, distance });
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
candidates = candidates.sort((a, b) => a.distance - b.distance);
|
|
692
|
+
let observerIndex;
|
|
693
|
+
|
|
694
|
+
for (let i = 0; i < candidates.length; i++) {
|
|
695
|
+
const { obVector, distance, panoIndex } = candidates[i];
|
|
696
|
+
const isImpactedRes = isImpacted(five$1, fromPositionVector, obVector, distance);
|
|
697
|
+
|
|
698
|
+
if (!isImpactedRes) {
|
|
699
|
+
observerIndex = panoIndex;
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
return typeof observerIndex === "number"
|
|
705
|
+
? observers[observerIndex]
|
|
706
|
+
: undefined;
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
const onIconClick = itemLabel => {
|
|
710
|
+
if (five$1.state.mode === five.Five.Mode.Panorama) return;
|
|
711
|
+
const observers = five$1.work.observers;
|
|
712
|
+
const fromPositionVector = new Vector3(itemLabel.position[0], itemLabel.position[1], itemLabel.position[2]);
|
|
713
|
+
const observer = getNearObserverPano(fromPositionVector, observers);
|
|
714
|
+
|
|
715
|
+
if (observer) {
|
|
716
|
+
console.log('--has observer--');
|
|
717
|
+
itemLabel.observerIndex = observer.panoIndex;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
if (typeof itemLabel.observerIndex === "number") {
|
|
721
|
+
const observer = observers[itemLabel.observerIndex];
|
|
722
|
+
const direction = fromPositionVector.clone().sub(observer.position).normalize();
|
|
723
|
+
|
|
724
|
+
const cameraCoord = {
|
|
725
|
+
longitude: Math.PI + Math.atan2(direction.x, direction.z),
|
|
726
|
+
latitude: Math.acos(direction.y / direction.length()) - Math.PI / 2
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
five$1.setState(Object.assign(Object.assign({}, cameraCoord), {
|
|
730
|
+
mode: five.Five.Mode.Panorama,
|
|
731
|
+
panoIndex: itemLabel.observerIndex
|
|
732
|
+
}));
|
|
733
|
+
|
|
734
|
+
// 游走结束更新 render list
|
|
735
|
+
five$1.once('initAnimationEnded', () => {
|
|
736
|
+
$$invalidate(1, renderItemLabels = renderItemLabels.map(item => {
|
|
737
|
+
return Object.assign(Object.assign({}, item), { isFold: item.id !== itemLabel.id });
|
|
738
|
+
}));
|
|
739
|
+
|
|
740
|
+
five$1.once('cameraUpdate', () => {
|
|
741
|
+
$$invalidate(1, renderItemLabels = renderItemLabels.map(item => {
|
|
742
|
+
return Object.assign(Object.assign({}, item), { isFold: false });
|
|
743
|
+
}));
|
|
744
|
+
});
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
svelte.beforeUpdate(() => {
|
|
750
|
+
addDataUpdateListener();
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
svelte.onMount(() => {
|
|
754
|
+
$$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
|
|
755
|
+
curItemLabels = itemLabels;
|
|
756
|
+
onItemLabelUpdate();
|
|
757
|
+
addResizeListener();
|
|
758
|
+
five$1.on('cameraUpdate', handleCameraUpdateCallback);
|
|
759
|
+
five$1.on('modeChange', onFiveModeChange);
|
|
760
|
+
});
|
|
761
|
+
|
|
519
762
|
svelte.onDestroy(() => {
|
|
520
|
-
five.off('cameraUpdate', handleCameraUpdateCallback);
|
|
763
|
+
five$1.off('cameraUpdate', handleCameraUpdateCallback);
|
|
764
|
+
five$1.off('modeChange', onFiveModeChange);
|
|
521
765
|
resizeObserver.unobserve(wrapper);
|
|
522
766
|
});
|
|
523
767
|
|
|
@@ -529,25 +773,29 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
529
773
|
}
|
|
530
774
|
|
|
531
775
|
$$self.$$set = $$props => {
|
|
532
|
-
if ('five' in $$props) $$invalidate(
|
|
533
|
-
if ('modelOcclusionEnable' in $$props) $$invalidate(
|
|
534
|
-
if ('itemLabels' in $$props) $$invalidate(
|
|
535
|
-
if ('wrapper' in $$props) $$invalidate(
|
|
536
|
-
if ('hooks' in $$props) $$invalidate(
|
|
537
|
-
if ('displayStrategyType' in $$props) $$invalidate(
|
|
776
|
+
if ('five' in $$props) $$invalidate(7, five$1 = $$props.five);
|
|
777
|
+
if ('modelOcclusionEnable' in $$props) $$invalidate(8, modelOcclusionEnable = $$props.modelOcclusionEnable);
|
|
778
|
+
if ('itemLabels' in $$props) $$invalidate(9, itemLabels = $$props.itemLabels);
|
|
779
|
+
if ('wrapper' in $$props) $$invalidate(10, wrapper = $$props.wrapper);
|
|
780
|
+
if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
|
|
781
|
+
if ('displayStrategyType' in $$props) $$invalidate(11, displayStrategyType = $$props.displayStrategyType);
|
|
782
|
+
if ('maxVisibleDistance' in $$props) $$invalidate(12, maxVisibleDistance = $$props.maxVisibleDistance);
|
|
538
783
|
};
|
|
539
784
|
|
|
540
785
|
return [
|
|
541
|
-
five,
|
|
542
786
|
hooks,
|
|
543
787
|
renderItemLabels,
|
|
788
|
+
anchorEnabled,
|
|
544
789
|
containerWidth,
|
|
545
790
|
containerHeight,
|
|
546
791
|
itemsVisible,
|
|
792
|
+
onIconClick,
|
|
793
|
+
five$1,
|
|
547
794
|
modelOcclusionEnable,
|
|
548
795
|
itemLabels,
|
|
549
796
|
wrapper,
|
|
550
797
|
displayStrategyType,
|
|
798
|
+
maxVisibleDistance,
|
|
551
799
|
div_elementresize_handler
|
|
552
800
|
];
|
|
553
801
|
}
|
|
@@ -563,25 +811,28 @@ class ItemLabelComponent extends internal.SvelteComponent {
|
|
|
563
811
|
create_fragment,
|
|
564
812
|
internal.safe_not_equal,
|
|
565
813
|
{
|
|
566
|
-
five:
|
|
567
|
-
modelOcclusionEnable:
|
|
568
|
-
itemLabels:
|
|
569
|
-
wrapper:
|
|
570
|
-
hooks:
|
|
571
|
-
displayStrategyType:
|
|
814
|
+
five: 7,
|
|
815
|
+
modelOcclusionEnable: 8,
|
|
816
|
+
itemLabels: 9,
|
|
817
|
+
wrapper: 10,
|
|
818
|
+
hooks: 0,
|
|
819
|
+
displayStrategyType: 11,
|
|
820
|
+
maxVisibleDistance: 12
|
|
572
821
|
},
|
|
573
|
-
add_css
|
|
822
|
+
add_css,
|
|
823
|
+
[-1, -1]
|
|
574
824
|
);
|
|
575
825
|
}
|
|
576
826
|
}
|
|
577
827
|
|
|
578
828
|
/** @description 转成内部所需数据 */
|
|
579
829
|
function parseItemLabelPluginData(data) {
|
|
580
|
-
return data.item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1], label.position[2]] }, label)));
|
|
830
|
+
return data.item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined }, label)));
|
|
581
831
|
}
|
|
582
832
|
|
|
833
|
+
const defaultMaxVisibleDistance = undefined;
|
|
583
834
|
const Plugin = (five$1, params) => {
|
|
584
|
-
var _a, _b;
|
|
835
|
+
var _a, _b, _c;
|
|
585
836
|
const pluginState = {
|
|
586
837
|
container: document.createElement('div'),
|
|
587
838
|
data: null,
|
|
@@ -593,6 +844,7 @@ const Plugin = (five$1, params) => {
|
|
|
593
844
|
hooks: new five.Subscribe(),
|
|
594
845
|
modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
|
|
595
846
|
displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL,
|
|
847
|
+
maxVisibleDistance: (_c = params === null || params === void 0 ? void 0 : params.maxVisibleDistance) !== null && _c !== void 0 ? _c : defaultMaxVisibleDistance,
|
|
596
848
|
};
|
|
597
849
|
pluginState.container.setAttribute('class', 'item-label-plugin-container');
|
|
598
850
|
pluginState.container.style.cssText = `
|
|
@@ -629,7 +881,6 @@ const Plugin = (five$1, params) => {
|
|
|
629
881
|
return true;
|
|
630
882
|
};
|
|
631
883
|
const dispose = () => {
|
|
632
|
-
removeListener4Five();
|
|
633
884
|
pluginState.container.remove();
|
|
634
885
|
};
|
|
635
886
|
const render = () => {
|
|
@@ -652,7 +903,8 @@ const Plugin = (five$1, params) => {
|
|
|
652
903
|
itemLabels: pluginState.itemLabels,
|
|
653
904
|
wrapper: pluginState.wrapper,
|
|
654
905
|
hooks: pluginState.hooks,
|
|
655
|
-
displayStrategyType: pluginState.displayStrategyType
|
|
906
|
+
displayStrategyType: pluginState.displayStrategyType,
|
|
907
|
+
maxVisibleDistance: pluginState.maxVisibleDistance
|
|
656
908
|
}
|
|
657
909
|
});
|
|
658
910
|
}
|
|
@@ -665,23 +917,9 @@ const Plugin = (five$1, params) => {
|
|
|
665
917
|
};
|
|
666
918
|
// 添加 five 监听
|
|
667
919
|
const addListener4Five = () => {
|
|
668
|
-
five
|
|
920
|
+
// five.on('modeChange', onFiveModeChange)
|
|
669
921
|
five$1.once('dispose', dispose);
|
|
670
922
|
};
|
|
671
|
-
// 取消 five 监听
|
|
672
|
-
const removeListener4Five = () => {
|
|
673
|
-
five$1.off('modeChange', onFiveModeChange);
|
|
674
|
-
};
|
|
675
|
-
const onFiveModeChange = (mode) => {
|
|
676
|
-
if (!pluginState.enabled)
|
|
677
|
-
return;
|
|
678
|
-
pluginState.fiveModeEnabled = false;
|
|
679
|
-
render();
|
|
680
|
-
five$1.once('initAnimationEnded', () => {
|
|
681
|
-
pluginState.fiveModeEnabled = true;
|
|
682
|
-
render();
|
|
683
|
-
});
|
|
684
|
-
};
|
|
685
923
|
addListener4Five();
|
|
686
924
|
return {
|
|
687
925
|
appendTo,
|