@realsee/dnalogel 2.0.0-alpha.29 → 2.0.0-alpha.30

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.
Files changed (197) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/dist/ItemLabelPlugin/Plugin.d.ts +4 -0
  3. package/dist/ItemLabelPlugin/events.type.d.ts +9 -0
  4. package/dist/ItemLabelPlugin/index.d.ts +9 -0
  5. package/dist/ItemLabelPlugin/index.js +922 -0
  6. package/dist/ItemLabelPlugin/typings.d.ts +59 -0
  7. package/dist/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
  8. package/dist/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
  9. package/dist/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
  10. package/dist/ItemLabelPlugin/utils/parseData.d.ts +3 -0
  11. package/dist/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
  12. package/dist/PanoMeasurePlugin/Controller/BaseController.d.ts +5 -2
  13. package/dist/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
  14. package/dist/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -0
  15. package/dist/PanoMeasurePlugin/Controller/index.d.ts +17 -8
  16. package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +1 -1
  17. package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +1 -1
  18. package/dist/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +3 -0
  19. package/dist/PanoMeasurePlugin/Modules/Magnifier.d.ts +49 -14
  20. package/dist/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
  21. package/dist/PanoMeasurePlugin/Modules/UIController/index.d.ts +4 -0
  22. package/dist/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
  23. package/dist/PanoMeasurePlugin/Modules/UIController/style.d.ts +2 -0
  24. package/dist/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
  25. package/dist/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
  26. package/dist/PanoMeasurePlugin/index.d.ts +8 -5
  27. package/dist/PanoMeasurePlugin/index.js +1893 -3431
  28. package/dist/PanoMeasurePlugin/typings/data.d.ts +4 -0
  29. package/dist/PanoMeasurePlugin/typings/event.type.d.ts +10 -1
  30. package/dist/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
  31. package/dist/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -2
  32. package/dist/floorplan/ModelFloorplanPlugin/index.js +3 -3
  33. package/dist/floorplan/TopviewFloorplanPlugin/index.js +3 -3
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.es.js +4939 -5627
  36. package/dist/index.js +5607 -6291
  37. package/dist/index.umd.js +5610 -6295
  38. package/dist/shared-utils/index.d.ts +1 -0
  39. package/dist/shared-utils/math/Interval.d.ts +13 -0
  40. package/dist/shared-utils/math/Rectangle.d.ts +27 -0
  41. package/dist/shared-utils/math/index.d.ts +2 -0
  42. package/docs/assets/search.js +1 -1
  43. package/docs/classes/Magnifier.html +9 -0
  44. package/docs/classes/ModelRoomLabelController.html +5 -5
  45. package/docs/classes/PanoFloorplanRadarPluginController.html +2 -2
  46. package/docs/enums/CameraMovementEffect.html +2 -2
  47. package/docs/enums/DIRECTION.html +1 -1
  48. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  49. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  50. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -0
  51. package/docs/enums/ModelFloorplanErrorType.html +1 -1
  52. package/docs/enums/Rotation.html +2 -2
  53. package/docs/index.html +2 -2
  54. package/docs/interfaces/CSS3DRenderPluginExportType.html +3 -3
  55. package/docs/interfaces/CameraMovementPluginExportType.html +3 -3
  56. package/docs/interfaces/FloorplanBounding.html +5 -5
  57. package/docs/interfaces/FloorplanData.html +2 -2
  58. package/docs/interfaces/FloorplanEntrance.html +8 -8
  59. package/docs/interfaces/FloorplanExtraObject.html +4 -4
  60. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  61. package/docs/interfaces/FloorplanFloorData.html +2 -2
  62. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  63. package/docs/interfaces/FloorplanObserver.html +2 -2
  64. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  65. package/docs/interfaces/FloorplanPosition.html +2 -2
  66. package/docs/interfaces/FloorplanRoomItem.html +7 -7
  67. package/docs/interfaces/FloorplanRoomLabelItem.html +4 -4
  68. package/docs/interfaces/FloorplanServerBounding.html +5 -5
  69. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  70. package/docs/interfaces/FloorplanServerData.html +2 -2
  71. package/docs/interfaces/FloorplanServerEntrance.html +8 -8
  72. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  73. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  74. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  75. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  76. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  77. package/docs/interfaces/FloorplanServerRoomItem.html +8 -8
  78. package/docs/interfaces/FloorplanServerRoomLabelItem.html +4 -4
  79. package/docs/interfaces/ItemLabelPluginData.html +1 -0
  80. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -0
  81. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -0
  82. package/docs/interfaces/LineJson.html +1 -1
  83. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  84. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  85. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  86. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  87. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  88. package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
  89. package/docs/interfaces/ModelFloorplanViewEvent.html +3 -3
  90. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  91. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  92. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  93. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  94. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  95. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  96. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  97. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  98. package/docs/interfaces/OpenParameter.html +3 -0
  99. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  100. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  101. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  102. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  103. package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +1 -1
  104. package/docs/interfaces/PanoMeasureParameterType.html +1 -0
  105. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  106. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  107. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  108. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  109. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  110. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  111. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  112. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  113. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  114. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  115. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  116. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  117. package/docs/interfaces/Point.html +1 -1
  118. package/docs/interfaces/PointJson.html +1 -1
  119. package/docs/interfaces/Room.html +1 -1
  120. package/docs/interfaces/RoomInfo.html +1 -1
  121. package/docs/interfaces/RoomLabel.html +7 -7
  122. package/docs/interfaces/RoomRules.html +1 -1
  123. package/docs/interfaces/Rooms.html +1 -1
  124. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +10 -10
  125. package/docs/modules.html +20 -20
  126. package/libs/ItemLabelPlugin/ItemLabelComponent.js +558 -0
  127. package/libs/ItemLabelPlugin/ItemLabelItem.js +228 -0
  128. package/libs/ItemLabelPlugin/Plugin.d.ts +4 -0
  129. package/libs/ItemLabelPlugin/Plugin.js +120 -0
  130. package/libs/ItemLabelPlugin/events.type.d.ts +9 -0
  131. package/libs/ItemLabelPlugin/events.type.js +1 -0
  132. package/libs/ItemLabelPlugin/index.d.ts +9 -0
  133. package/libs/ItemLabelPlugin/index.js +8 -0
  134. package/libs/ItemLabelPlugin/typings.d.ts +59 -0
  135. package/libs/ItemLabelPlugin/typings.js +7 -0
  136. package/libs/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
  137. package/libs/ItemLabelPlugin/utils/getLabelTransform.js +3 -0
  138. package/libs/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
  139. package/libs/ItemLabelPlugin/utils/getStrokeLength.js +16 -0
  140. package/libs/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
  141. package/libs/ItemLabelPlugin/utils/isImpacted.js +12 -0
  142. package/libs/ItemLabelPlugin/utils/parseData.d.ts +3 -0
  143. package/libs/ItemLabelPlugin/utils/parseData.js +4 -0
  144. package/libs/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
  145. package/libs/ItemLabelPlugin/utils/transform2RenderData.js +4 -0
  146. package/libs/PanoMeasurePlugin/Controller/BaseController.d.ts +5 -2
  147. package/libs/PanoMeasurePlugin/Controller/BaseController.js +9 -1
  148. package/libs/PanoMeasurePlugin/Controller/EditController.js +4 -4
  149. package/libs/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
  150. package/libs/PanoMeasurePlugin/Controller/MixedController.js +337 -0
  151. package/libs/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -0
  152. package/libs/PanoMeasurePlugin/Controller/WatchController.js +14 -3
  153. package/libs/PanoMeasurePlugin/Controller/index.d.ts +17 -8
  154. package/libs/PanoMeasurePlugin/Controller/index.js +57 -18
  155. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +1 -1
  156. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +11 -14
  157. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +1 -1
  158. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +1 -1
  159. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +3 -0
  160. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +48 -11
  161. package/libs/PanoMeasurePlugin/Modules/Magnifier.d.ts +49 -14
  162. package/libs/PanoMeasurePlugin/Modules/Magnifier.js +185 -60
  163. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +1 -1
  164. package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
  165. package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.js +98 -0
  166. package/libs/PanoMeasurePlugin/Modules/UIController/index.d.ts +4 -0
  167. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +24 -7
  168. package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
  169. package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.js +80 -0
  170. package/libs/PanoMeasurePlugin/Modules/UIController/style.d.ts +2 -0
  171. package/libs/PanoMeasurePlugin/Modules/UIController/style.js +10 -1
  172. package/libs/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
  173. package/libs/PanoMeasurePlugin/Modules/rangePiece/html.js +64 -0
  174. package/libs/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
  175. package/libs/PanoMeasurePlugin/Modules/rangePiece/index.js +265 -0
  176. package/libs/PanoMeasurePlugin/index.d.ts +8 -5
  177. package/libs/PanoMeasurePlugin/index.js +2 -0
  178. package/libs/PanoMeasurePlugin/typings/data.d.ts +4 -0
  179. package/libs/PanoMeasurePlugin/typings/event.type.d.ts +10 -1
  180. package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
  181. package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.js +15 -0
  182. package/libs/PanoMeasurePlugin/utils/constants.js +7 -7
  183. package/libs/PanoMeasurePlugin/utils/distanceDom.js +19 -14
  184. package/libs/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -2
  185. package/libs/PanoMeasurePlugin/utils/mouseGroup.js +5 -6
  186. package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +3 -3
  187. package/libs/index.d.ts +1 -0
  188. package/libs/index.js +2 -1
  189. package/libs/shared-utils/index.d.ts +1 -0
  190. package/libs/shared-utils/index.js +1 -0
  191. package/libs/shared-utils/math/Interval.d.ts +13 -0
  192. package/libs/shared-utils/math/Interval.js +40 -0
  193. package/libs/shared-utils/math/Rectangle.d.ts +27 -0
  194. package/libs/shared-utils/math/Rectangle.js +50 -0
  195. package/libs/shared-utils/math/index.d.ts +2 -0
  196. package/libs/shared-utils/math/index.js +2 -0
  197. package/package.json +3 -1
@@ -0,0 +1,922 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var five = require('@realsee/five');
6
+ var internal = require('svelte/internal');
7
+ var svelte = require('svelte');
8
+ var THREE = require('three');
9
+ var classNames = require('classnames');
10
+
11
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+
13
+ function _interopNamespace(e) {
14
+ if (e && e.__esModule) return e;
15
+ var n = Object.create(null);
16
+ if (e) {
17
+ Object.keys(e).forEach(function (k) {
18
+ if (k !== 'default') {
19
+ var d = Object.getOwnPropertyDescriptor(e, k);
20
+ Object.defineProperty(n, k, d.get ? d : {
21
+ enumerable: true,
22
+ get: function () { return e[k]; }
23
+ });
24
+ }
25
+ });
26
+ }
27
+ n["default"] = e;
28
+ return Object.freeze(n);
29
+ }
30
+
31
+ var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
32
+ var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
33
+
34
+ exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE = void 0;
35
+ (function (ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE) {
36
+ ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE["SMALL"] = "small";
37
+ ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE["MIDLLE"] = "middle";
38
+ ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE["LARGE"] = "large";
39
+ ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE["EXTRA_LARGE"] = "x-large";
40
+ })(exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE || (exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE = {}));
41
+
42
+ /* src/ItemLabelPlugin/ItemLabelItem.svelte generated by Svelte v3.47.0 */
43
+
44
+ function add_css$1(target) {
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
+ }
47
+
48
+ // (21:2) {#if itemLabel.icon}
49
+ function create_if_block$1(ctx) {
50
+ let div1;
51
+ let div0;
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 ?? defaultIcon})`);
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 ?? defaultIcon})`)) {
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;
89
+ let t0;
90
+ let div0;
91
+ let span0;
92
+ let t1_value = (/*itemLabel*/ ctx[0].code ?? /*itemLabel*/ ctx[0].id) + "";
93
+ let t1;
94
+ let t2;
95
+ let span1;
96
+ let t3_value = /*itemLabel*/ ctx[0].name + "";
97
+ let t3;
98
+ let t4;
99
+ let div2;
100
+ let div2_class_value;
101
+ let div3_class_value;
102
+ let mounted;
103
+ let dispose;
104
+ let if_block = /*itemLabel*/ ctx[0].icon && create_if_block$1(ctx);
105
+
106
+ return {
107
+ c() {
108
+ div3 = internal.element("div");
109
+ div1 = internal.element("div");
110
+ if (if_block) if_block.c();
111
+ t0 = internal.space();
112
+ div0 = internal.element("div");
113
+ span0 = internal.element("span");
114
+ t1 = internal.text(t1_value);
115
+ t2 = internal.space();
116
+ span1 = internal.element("span");
117
+ t3 = internal.text(t3_value);
118
+ t4 = internal.space();
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);
130
+ },
131
+ m(target, anchor) {
132
+ internal.insert(target, div3, anchor);
133
+ internal.append(div3, div1);
134
+ if (if_block) if_block.m(div1, null);
135
+ internal.append(div1, t0);
136
+ internal.append(div1, div0);
137
+ internal.append(div0, span0);
138
+ internal.append(span0, t1);
139
+ internal.append(div0, t2);
140
+ internal.append(div0, span1);
141
+ internal.append(span1, t3);
142
+ internal.append(div3, t4);
143
+ internal.append(div3, div2);
144
+
145
+ if (!mounted) {
146
+ dispose = internal.listen(div1, "click", /*onClick*/ ctx[3]);
147
+ mounted = true;
148
+ }
149
+ },
150
+ p(ctx, [dirty]) {
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;
162
+ }
163
+
164
+ if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code ?? /*itemLabel*/ ctx[0].id) + "")) internal.set_data(t1, t1_value);
165
+ if (dirty & /*itemLabel*/ 1 && t3_value !== (t3_value = /*itemLabel*/ ctx[0].name + "")) internal.set_data(t3, t3_value);
166
+
167
+ if (dirty & /*itemLabel*/ 1) {
168
+ internal.set_style(div1, "bottom", `${/*itemLabel*/ ctx[0].strokeLength}px`);
169
+ }
170
+
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);
173
+ }
174
+
175
+ if (dirty & /*itemLabel*/ 1) {
176
+ internal.set_style(div2, "height", `${/*itemLabel*/ ctx[0].strokeLength}px`);
177
+ }
178
+
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);
181
+ }
182
+
183
+ if (dirty & /*itemLabel*/ 1) {
184
+ internal.set_style(div3, "z-index", /*itemLabel*/ ctx[0].zIndex, false);
185
+ }
186
+
187
+ if (dirty & /*itemLabel*/ 1) {
188
+ internal.set_style(div3, "transform", /*itemLabel*/ ctx[0].transform, false);
189
+ }
190
+ },
191
+ i: internal.noop,
192
+ o: internal.noop,
193
+ d(detaching) {
194
+ if (detaching) internal.detach(div3);
195
+ if (if_block) if_block.d();
196
+ mounted = false;
197
+ dispose();
198
+ }
199
+ };
200
+ }
201
+
202
+ const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n';
203
+
204
+ function instance$1($$self, $$props, $$invalidate) {
205
+ let { itemLabel } = $$props;
206
+ let { hooks } = $$props;
207
+ let { anchorEnabled } = $$props;
208
+ let { onIconClick } = $$props;
209
+
210
+ function onClick() {
211
+ hooks.emit('onLabelClick', itemLabel);
212
+ }
213
+
214
+ const click_handler = e => onIconClick(itemLabel);
215
+
216
+ $$self.$$set = $$props => {
217
+ if ('itemLabel' in $$props) $$invalidate(0, itemLabel = $$props.itemLabel);
218
+ if ('hooks' in $$props) $$invalidate(4, hooks = $$props.hooks);
219
+ if ('anchorEnabled' in $$props) $$invalidate(1, anchorEnabled = $$props.anchorEnabled);
220
+ if ('onIconClick' in $$props) $$invalidate(2, onIconClick = $$props.onIconClick);
221
+ };
222
+
223
+ return [itemLabel, anchorEnabled, onIconClick, onClick, hooks, click_handler];
224
+ }
225
+
226
+ class ItemLabelItem extends internal.SvelteComponent {
227
+ constructor(options) {
228
+ super();
229
+
230
+ internal.init(
231
+ this,
232
+ options,
233
+ instance$1,
234
+ create_fragment$1,
235
+ internal.safe_not_equal,
236
+ {
237
+ itemLabel: 0,
238
+ hooks: 4,
239
+ anchorEnabled: 1,
240
+ onIconClick: 2
241
+ },
242
+ add_css$1
243
+ );
244
+ }
245
+ }
246
+
247
+ /**
248
+ * 创建一个防抖动函数,该函数会在 wait 毫秒后调用 func 方法
249
+ * @param func - 要防抖动的函数
250
+ * @param [wait=0] - 需要延迟的毫秒数
251
+ */
252
+ function debounce(func, wait = 200) {
253
+ let last;
254
+ return function (...args) {
255
+ clearTimeout(last);
256
+ last = setTimeout(() => {
257
+ func(...args);
258
+ }, wait);
259
+ };
260
+ }
261
+
262
+ const { Raycaster, Vector3 } = THREE__namespace;
263
+ /**
264
+ * 碰撞检测可见性
265
+ * */
266
+ const isImpacted = (five, sourceVector, targetVector, distance) => {
267
+ const direction = sourceVector.clone().sub(targetVector).normalize();
268
+ const raycaster = new Raycaster();
269
+ raycaster.set(targetVector, direction);
270
+ const [intersection] = five.model.intersectRaycaster(raycaster);
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
+
299
+ /* src/ItemLabelPlugin/ItemLabelComponent.svelte generated by Svelte v3.47.0 */
300
+
301
+ function add_css(target) {
302
+ internal.append_styles(target, "svelte-gk8s47", ".item-labels-container.svelte-gk8s47{width:100%;height:100%;position:relative}");
303
+ }
304
+
305
+ function get_each_context(ctx, list, i) {
306
+ const child_ctx = ctx.slice();
307
+ child_ctx[31] = list[i];
308
+ return child_ctx;
309
+ }
310
+
311
+ // (229:2) {#if itemLabelItem.visible}
312
+ function create_if_block(ctx) {
313
+ let itemlabelitem;
314
+ let current;
315
+
316
+ itemlabelitem = new ItemLabelItem({
317
+ props: {
318
+ itemLabel: /*itemLabelItem*/ ctx[31],
319
+ hooks: /*hooks*/ ctx[0],
320
+ anchorEnabled: /*anchorEnabled*/ ctx[2],
321
+ onIconClick: /*onIconClick*/ ctx[6]
322
+ }
323
+ });
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[31];
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
+ // (228: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[31].visible && create_if_block(ctx);
361
+
362
+ return {
363
+ key: key_1,
364
+ first: null,
365
+ c() {
366
+ first = internal.empty();
367
+ if (if_block) if_block.c();
368
+ if_block_anchor = internal.empty();
369
+ this.first = first;
370
+ },
371
+ m(target, anchor) {
372
+ internal.insert(target, first, anchor);
373
+ if (if_block) if_block.m(target, anchor);
374
+ internal.insert(target, if_block_anchor, anchor);
375
+ current = true;
376
+ },
377
+ p(new_ctx, dirty) {
378
+ ctx = new_ctx;
379
+
380
+ if (/*itemLabelItem*/ ctx[31].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
+ }
402
+ },
403
+ i(local) {
404
+ if (current) return;
405
+ internal.transition_in(if_block);
406
+ current = true;
407
+ },
408
+ o(local) {
409
+ internal.transition_out(if_block);
410
+ current = false;
411
+ },
412
+ d(detaching) {
413
+ if (detaching) internal.detach(first);
414
+ if (if_block) if_block.d(detaching);
415
+ if (detaching) internal.detach(if_block_anchor);
416
+ }
417
+ };
418
+ }
419
+
420
+ function create_fragment(ctx) {
421
+ let div;
422
+ let each_blocks = [];
423
+ let each_1_lookup = new Map();
424
+ let div_resize_listener;
425
+ let current;
426
+ let each_value = /*renderItemLabels*/ ctx[1];
427
+ const get_key = ctx => /*itemLabelItem*/ ctx[31].id;
428
+
429
+ for (let i = 0; i < each_value.length; i += 1) {
430
+ let child_ctx = get_each_context(ctx, each_value, i);
431
+ let key = get_key(child_ctx);
432
+ each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx));
433
+ }
434
+
435
+ return {
436
+ c() {
437
+ div = internal.element("div");
438
+
439
+ for (let i = 0; i < each_blocks.length; i += 1) {
440
+ each_blocks[i].c();
441
+ }
442
+
443
+ internal.attr(div, "class", "item-labels-container svelte-gk8s47");
444
+ internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[13].call(div));
445
+ internal.set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
446
+ },
447
+ m(target, anchor) {
448
+ internal.insert(target, div, anchor);
449
+
450
+ for (let i = 0; i < each_blocks.length; i += 1) {
451
+ each_blocks[i].m(div, null);
452
+ }
453
+
454
+ div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[13].bind(div));
455
+ current = true;
456
+ },
457
+ p(ctx, dirty) {
458
+ if (dirty[0] & /*renderItemLabels, hooks, anchorEnabled, onIconClick*/ 71) {
459
+ each_value = /*renderItemLabels*/ ctx[1];
460
+ internal.group_outros();
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);
462
+ internal.check_outros();
463
+ }
464
+
465
+ if (dirty[0] & /*itemsVisible*/ 32) {
466
+ internal.set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
467
+ }
468
+ },
469
+ i(local) {
470
+ if (current) return;
471
+
472
+ for (let i = 0; i < each_value.length; i += 1) {
473
+ internal.transition_in(each_blocks[i]);
474
+ }
475
+
476
+ current = true;
477
+ },
478
+ o(local) {
479
+ for (let i = 0; i < each_blocks.length; i += 1) {
480
+ internal.transition_out(each_blocks[i]);
481
+ }
482
+
483
+ current = false;
484
+ },
485
+ d(detaching) {
486
+ if (detaching) internal.detach(div);
487
+
488
+ for (let i = 0; i < each_blocks.length; i += 1) {
489
+ each_blocks[i].d();
490
+ }
491
+
492
+ div_resize_listener();
493
+ }
494
+ };
495
+ }
496
+ let basicWidth = 11;
497
+
498
+ function instance($$self, $$props, $$invalidate) {
499
+ const { Raycaster, Vector3 } = THREE__namespace;
500
+ let { five: five$1 } = $$props;
501
+ let { modelOcclusionEnable } = $$props;
502
+ let { itemLabels } = $$props;
503
+ let { wrapper } = $$props;
504
+ let { hooks } = $$props;
505
+ let { displayStrategyType } = $$props;
506
+ let { maxVisibleDistance } = $$props;
507
+ let curItemLabels = null;
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
+
514
+ let wrapperSize = { width: 0, height: 0 };
515
+ let containerWidth;
516
+ let containerHeight;
517
+
518
+ // 计算重叠
519
+ let cssOffsetLists = [];
520
+
521
+ // 动画过程中 itemsVisible 为 false
522
+ let itemsVisible = true;
523
+
524
+ /**
525
+ * 可见性策略:
526
+ * 1、当前楼层(假设先不考虑多楼层)
527
+ * 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
528
+ * */
529
+ const getLabelVisible = (five$1, itemLabel) => {
530
+ // 虚拟 VR 仅有一层,不考虑楼层信息
531
+ const cameraPosition = five$1.camera.position.clone();
532
+
533
+ const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
534
+
535
+ // 计算点到相机的位置
536
+ const vectorDistance = modelPosition.distanceTo(cameraPosition);
537
+
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
+ // cssOffset 获取
551
+ const getLabelCssOffset = (five, itemLabel) => {
552
+ const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
553
+ const cssPosition = five.project2d(modelPosition);
554
+
555
+ const xOffset = cssPosition === null || cssPosition === void 0
556
+ ? void 0
557
+ : cssPosition.x;
558
+
559
+ const yOffset = cssPosition === null || cssPosition === void 0
560
+ ? void 0
561
+ : cssPosition.y;
562
+
563
+ return [xOffset, yOffset];
564
+ };
565
+
566
+ const getFormatedItemLabels = (five, labels) => {
567
+ // 计算位置 & 可见性
568
+ const newLabels = labels.map(label => {
569
+ const cssOffset = getLabelCssOffset(five, label);
570
+ label.name.length * basicWidth;
571
+ const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
572
+
573
+ // 是否加入碰撞检测
574
+ const naturalVisible = modelOcclusionEnable
575
+ ? getLabelVisible(five, label)
576
+ : label.visible;
577
+
578
+ const visible = naturalVisible;
579
+
580
+ // 关掉重叠计算
581
+ // const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth)
582
+ if (!visible) return Object.assign(Object.assign({}, label), { visible });
583
+
584
+ cssOffsetLists.push(cssOffset);
585
+
586
+ // position
587
+ const transform = getLabelTransform(cssOffset);
588
+
589
+ return Object.assign(Object.assign({}, label), { visible, transform, strokeLength });
590
+ });
591
+
592
+ const sortedItemLabelItems = newLabels.filter(({ visible }) => visible).map(label => ({
593
+ itemLabelItem: label,
594
+ distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five.camera.position)
595
+ })).sort((a, b) => a.distance - b.distance);
596
+
597
+ return newLabels.map(label => {
598
+ const sortIndex = sortedItemLabelItems.findIndex(item => item.itemLabelItem.id === label.id);
599
+ if (sortIndex !== undefined) return Object.assign(Object.assign({}, label), { zIndex: sortIndex * 10 });
600
+ return label;
601
+ });
602
+ };
603
+
604
+ const onItemLabelUpdate = () => {
605
+ cssOffsetLists = [];
606
+ $$invalidate(1, renderItemLabels = getFormatedItemLabels(five$1, renderItemLabels));
607
+ };
608
+
609
+ svelte.beforeUpdate(() => {
610
+ addDataUpdateListener();
611
+ });
612
+
613
+ const handleCameraUpdateCallback = () => {
614
+ $$invalidate(5, itemsVisible = false);
615
+ handleCameraUpdate();
616
+ };
617
+
618
+ svelte.onMount(() => {
619
+ $$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
620
+ curItemLabels = itemLabels;
621
+ onItemLabelUpdate();
622
+ addResizeListener();
623
+ five$1.on('cameraUpdate', handleCameraUpdateCallback);
624
+ five$1.on('modeChange', onFiveModeChange);
625
+ });
626
+
627
+ const onFiveModeChange = mode => {
628
+ $$invalidate(5, itemsVisible = false);
629
+
630
+ five$1.once('initAnimationEnded', (panoIndex, pose, userAction) => {
631
+ $$invalidate(2, anchorEnabled = mode === five.Five.Mode.Panorama);
632
+ $$invalidate(5, itemsVisible = true);
633
+ if (!userAction) return; else onItemLabelUpdate();
634
+ });
635
+ };
636
+
637
+ const handleCameraUpdate = debounce(
638
+ () => {
639
+ $$invalidate(5, itemsVisible = true);
640
+ onItemLabelUpdate();
641
+ },
642
+ 300
643
+ );
644
+
645
+ const addResizeListener = () => {
646
+ wrapperSize = {
647
+ width: wrapper.clientWidth,
648
+ height: wrapper.clientHeight
649
+ };
650
+
651
+ resizeObserver.observe(wrapper);
652
+ };
653
+
654
+ const addDataUpdateListener = () => {
655
+ if (curItemLabels !== itemLabels) {
656
+ $$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
657
+ curItemLabels = itemLabels;
658
+ onItemLabelUpdate();
659
+ }
660
+ };
661
+
662
+ const resizeObserver = new ResizeObserver(entries => {
663
+ const entry = entries[0];
664
+ const target = entry.target;
665
+ const curWidth = target.clientWidth;
666
+ const curHeight = target.clientHeight;
667
+
668
+ if (wrapperSize.width !== curWidth || wrapperSize.height !== curHeight) {
669
+ wrapperSize = { width: curWidth, height: curHeight };
670
+ onItemLabelUpdate();
671
+ }
672
+ });
673
+
674
+ svelte.onDestroy(() => {
675
+ five$1.off('cameraUpdate', handleCameraUpdateCallback);
676
+ five$1.off('modeChange', onFiveModeChange);
677
+ resizeObserver.unobserve(wrapper);
678
+ });
679
+
680
+ const getNearObserverPano = (fromPositionVector, observers) => {
681
+ let candidates = [];
682
+
683
+ for (let i = 0; i < observers.length; i++) {
684
+ const { position: obVector, panoIndex } = observers[i];
685
+ const distance = fromPositionVector.distanceTo(obVector);
686
+
687
+ if (maxVisibleDistance === undefined || distance <= maxVisibleDistance || five$1.state.mode !== five.Five.Mode.Panorama) {
688
+ candidates.push({ panoIndex, obVector, distance });
689
+ }
690
+ }
691
+
692
+ candidates = candidates.sort((a, b) => a.distance - b.distance);
693
+ let observerIndex;
694
+
695
+ for (let i = 0; i < candidates.length; i++) {
696
+ const { obVector, distance, panoIndex } = candidates[i];
697
+ const isImpactedRes = isImpacted(five$1, fromPositionVector, obVector, distance);
698
+
699
+ if (!isImpactedRes) {
700
+ observerIndex = panoIndex;
701
+ break;
702
+ }
703
+ }
704
+
705
+ return typeof observerIndex === "number"
706
+ ? observers[observerIndex]
707
+ : undefined;
708
+ };
709
+
710
+ const onIconClick = itemLabel => {
711
+ if (five$1.state.mode === five.Five.Mode.Panorama) return;
712
+ const observers = five$1.work.observers;
713
+ const fromPositionVector = new Vector3(itemLabel.position[0], itemLabel.position[1], itemLabel.position[2]);
714
+ const observer = getNearObserverPano(fromPositionVector, observers);
715
+
716
+ if (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
+ function div_elementresize_handler() {
750
+ containerWidth = this.clientWidth;
751
+ containerHeight = this.clientHeight;
752
+ $$invalidate(3, containerWidth);
753
+ $$invalidate(4, containerHeight);
754
+ }
755
+
756
+ $$self.$$set = $$props => {
757
+ if ('five' in $$props) $$invalidate(7, five$1 = $$props.five);
758
+ if ('modelOcclusionEnable' in $$props) $$invalidate(8, modelOcclusionEnable = $$props.modelOcclusionEnable);
759
+ if ('itemLabels' in $$props) $$invalidate(9, itemLabels = $$props.itemLabels);
760
+ if ('wrapper' in $$props) $$invalidate(10, wrapper = $$props.wrapper);
761
+ if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
762
+ if ('displayStrategyType' in $$props) $$invalidate(11, displayStrategyType = $$props.displayStrategyType);
763
+ if ('maxVisibleDistance' in $$props) $$invalidate(12, maxVisibleDistance = $$props.maxVisibleDistance);
764
+ };
765
+
766
+ return [
767
+ hooks,
768
+ renderItemLabels,
769
+ anchorEnabled,
770
+ containerWidth,
771
+ containerHeight,
772
+ itemsVisible,
773
+ onIconClick,
774
+ five$1,
775
+ modelOcclusionEnable,
776
+ itemLabels,
777
+ wrapper,
778
+ displayStrategyType,
779
+ maxVisibleDistance,
780
+ div_elementresize_handler
781
+ ];
782
+ }
783
+
784
+ class ItemLabelComponent extends internal.SvelteComponent {
785
+ constructor(options) {
786
+ super();
787
+
788
+ internal.init(
789
+ this,
790
+ options,
791
+ instance,
792
+ create_fragment,
793
+ internal.safe_not_equal,
794
+ {
795
+ five: 7,
796
+ modelOcclusionEnable: 8,
797
+ itemLabels: 9,
798
+ wrapper: 10,
799
+ hooks: 0,
800
+ displayStrategyType: 11,
801
+ maxVisibleDistance: 12
802
+ },
803
+ add_css,
804
+ [-1, -1]
805
+ );
806
+ }
807
+ }
808
+
809
+ /** @description 转成内部所需数据 */
810
+ function parseItemLabelPluginData(data) {
811
+ return data.item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined }, label)));
812
+ }
813
+
814
+ const defaultMaxVisibleDistance = undefined;
815
+ const Plugin = (five$1, params) => {
816
+ var _a, _b, _c;
817
+ const pluginState = {
818
+ container: document.createElement('div'),
819
+ data: null,
820
+ enabled: true,
821
+ fiveModeEnabled: true,
822
+ itemLabels: [],
823
+ wrapper: null,
824
+ app: undefined,
825
+ hooks: new five.Subscribe(),
826
+ modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
827
+ displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL,
828
+ maxVisibleDistance: (_c = params === null || params === void 0 ? void 0 : params.maxVisibleDistance) !== null && _c !== void 0 ? _c : defaultMaxVisibleDistance,
829
+ };
830
+ pluginState.container.setAttribute('class', 'item-label-plugin-container');
831
+ pluginState.container.style.cssText = `
832
+ position: absolute;
833
+ left: 0;
834
+ top: 0;
835
+ width: 100%;
836
+ height: 100%;
837
+ z-index: 5;
838
+ `;
839
+ pluginState.container.style.pointerEvents = 'none'; // 写到 cssText 里不生效
840
+ const appendTo = (wrapper) => {
841
+ pluginState.wrapper = wrapper;
842
+ wrapper.appendChild(pluginState.container);
843
+ render();
844
+ return true;
845
+ };
846
+ const load = (data) => {
847
+ pluginState.itemLabels = parseItemLabelPluginData(data);
848
+ render();
849
+ };
850
+ const enable = () => {
851
+ if (pluginState.enabled)
852
+ return true;
853
+ pluginState.enabled = true;
854
+ render();
855
+ return true;
856
+ };
857
+ const disable = () => {
858
+ if (!pluginState.enabled)
859
+ return true;
860
+ pluginState.enabled = false;
861
+ render();
862
+ return true;
863
+ };
864
+ const dispose = () => {
865
+ pluginState.container.remove();
866
+ };
867
+ const render = () => {
868
+ var _a;
869
+ if (!pluginState.wrapper)
870
+ return;
871
+ // 只要不可展示,销毁容器
872
+ if (!pluginState.enabled || !pluginState.fiveModeEnabled) {
873
+ (_a = pluginState.app) === null || _a === void 0 ? void 0 : _a.$destroy();
874
+ pluginState.app = undefined;
875
+ return;
876
+ }
877
+ // 正常显示时,分为 app 存在和不存在两种情况,如果存在,传值,不存在则初始化并传值
878
+ if (!pluginState.app) {
879
+ pluginState.app = new ItemLabelComponent({
880
+ target: pluginState.container,
881
+ props: {
882
+ five: five$1,
883
+ modelOcclusionEnable: pluginState.modelOcclusionEnable,
884
+ itemLabels: pluginState.itemLabels,
885
+ wrapper: pluginState.wrapper,
886
+ hooks: pluginState.hooks,
887
+ displayStrategyType: pluginState.displayStrategyType,
888
+ maxVisibleDistance: pluginState.maxVisibleDistance
889
+ }
890
+ });
891
+ }
892
+ else {
893
+ pluginState.app.$set({
894
+ five: five$1,
895
+ itemLabels: pluginState.itemLabels
896
+ });
897
+ }
898
+ };
899
+ // 添加 five 监听
900
+ const addListener4Five = () => {
901
+ // five.on('modeChange', onFiveModeChange)
902
+ five$1.once('dispose', dispose);
903
+ };
904
+ addListener4Five();
905
+ return {
906
+ appendTo,
907
+ load,
908
+ enable,
909
+ disable,
910
+ dispose,
911
+ hooks: pluginState.hooks
912
+ };
913
+ };
914
+
915
+ const itemLabelPluginServerParams = {
916
+ name: 'ItemLabelPlugin',
917
+ version: 0,
918
+ };
919
+
920
+ exports.ItemLabelPlugin = Plugin;
921
+ exports["default"] = Plugin;
922
+ exports.itemLabelPluginServerParams = itemLabelPluginServerParams;