@realsee/dnalogel 2.0.0-alpha.30-beta → 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 (183) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/ItemLabelPlugin/index.js +362 -143
  3. package/dist/ItemLabelPlugin/typings.d.ts +5 -0
  4. package/dist/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
  5. package/dist/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
  6. package/dist/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
  7. package/dist/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
  8. package/dist/PanoMeasurePlugin/Controller/BaseController.d.ts +5 -2
  9. package/dist/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
  10. package/dist/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -0
  11. package/dist/PanoMeasurePlugin/Controller/index.d.ts +17 -8
  12. package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +1 -1
  13. package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +1 -1
  14. package/dist/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +3 -0
  15. package/dist/PanoMeasurePlugin/Modules/Magnifier.d.ts +49 -14
  16. package/dist/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
  17. package/dist/PanoMeasurePlugin/Modules/UIController/index.d.ts +4 -0
  18. package/dist/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
  19. package/dist/PanoMeasurePlugin/Modules/UIController/style.d.ts +2 -0
  20. package/dist/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
  21. package/dist/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
  22. package/dist/PanoMeasurePlugin/index.d.ts +8 -5
  23. package/dist/PanoMeasurePlugin/index.js +1893 -3431
  24. package/dist/PanoMeasurePlugin/typings/data.d.ts +4 -0
  25. package/dist/PanoMeasurePlugin/typings/event.type.d.ts +10 -1
  26. package/dist/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
  27. package/dist/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -2
  28. package/dist/floorplan/ModelFloorplanPlugin/index.js +3 -3
  29. package/dist/floorplan/TopviewFloorplanPlugin/index.js +3 -3
  30. package/dist/index.es.js +1850 -3190
  31. package/dist/index.js +1784 -3122
  32. package/dist/index.umd.js +1787 -3126
  33. package/dist/shared-utils/index.d.ts +1 -0
  34. package/dist/shared-utils/math/Interval.d.ts +13 -0
  35. package/dist/shared-utils/math/Rectangle.d.ts +27 -0
  36. package/dist/shared-utils/math/index.d.ts +2 -0
  37. package/docs/assets/search.js +1 -1
  38. package/docs/classes/Magnifier.html +9 -0
  39. package/docs/classes/ModelRoomLabelController.html +5 -5
  40. package/docs/classes/PanoFloorplanRadarPluginController.html +2 -2
  41. package/docs/enums/CameraMovementEffect.html +2 -2
  42. package/docs/enums/DIRECTION.html +1 -1
  43. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  44. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  45. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  46. package/docs/enums/ModelFloorplanErrorType.html +1 -1
  47. package/docs/enums/Rotation.html +2 -2
  48. package/docs/index.html +2 -2
  49. package/docs/interfaces/CSS3DRenderPluginExportType.html +3 -3
  50. package/docs/interfaces/CameraMovementPluginExportType.html +3 -3
  51. package/docs/interfaces/FloorplanBounding.html +5 -5
  52. package/docs/interfaces/FloorplanData.html +2 -2
  53. package/docs/interfaces/FloorplanEntrance.html +8 -8
  54. package/docs/interfaces/FloorplanExtraObject.html +4 -4
  55. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  56. package/docs/interfaces/FloorplanFloorData.html +2 -2
  57. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  58. package/docs/interfaces/FloorplanObserver.html +2 -2
  59. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  60. package/docs/interfaces/FloorplanPosition.html +2 -2
  61. package/docs/interfaces/FloorplanRoomItem.html +7 -7
  62. package/docs/interfaces/FloorplanRoomLabelItem.html +4 -4
  63. package/docs/interfaces/FloorplanServerBounding.html +5 -5
  64. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  65. package/docs/interfaces/FloorplanServerData.html +2 -2
  66. package/docs/interfaces/FloorplanServerEntrance.html +8 -8
  67. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  68. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  69. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  70. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  71. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  72. package/docs/interfaces/FloorplanServerRoomItem.html +8 -8
  73. package/docs/interfaces/FloorplanServerRoomLabelItem.html +4 -4
  74. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  75. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  76. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  77. package/docs/interfaces/LineJson.html +1 -1
  78. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  79. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  80. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  81. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  82. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  83. package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
  84. package/docs/interfaces/ModelFloorplanViewEvent.html +3 -3
  85. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  86. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  87. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  88. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  89. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  90. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  91. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  92. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  93. package/docs/interfaces/OpenParameter.html +3 -0
  94. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  95. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  96. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  97. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  98. package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +1 -1
  99. package/docs/interfaces/PanoMeasureParameterType.html +1 -0
  100. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  101. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  102. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  103. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  104. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  105. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  106. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  107. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  108. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  109. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  110. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  111. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  112. package/docs/interfaces/Point.html +1 -1
  113. package/docs/interfaces/PointJson.html +1 -1
  114. package/docs/interfaces/Room.html +1 -1
  115. package/docs/interfaces/RoomInfo.html +1 -1
  116. package/docs/interfaces/RoomLabel.html +7 -7
  117. package/docs/interfaces/RoomRules.html +1 -1
  118. package/docs/interfaces/Rooms.html +1 -1
  119. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +10 -10
  120. package/docs/modules.html +20 -20
  121. package/libs/ItemLabelPlugin/ItemLabelComponent.js +211 -67
  122. package/libs/ItemLabelPlugin/ItemLabelItem.js +109 -54
  123. package/libs/ItemLabelPlugin/Plugin.js +7 -4
  124. package/libs/ItemLabelPlugin/typings.d.ts +5 -0
  125. package/libs/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
  126. package/libs/ItemLabelPlugin/utils/getLabelTransform.js +3 -0
  127. package/libs/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
  128. package/libs/ItemLabelPlugin/utils/getStrokeLength.js +16 -0
  129. package/libs/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
  130. package/libs/ItemLabelPlugin/utils/isImpacted.js +12 -0
  131. package/libs/ItemLabelPlugin/utils/parseData.js +1 -1
  132. package/libs/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
  133. package/libs/ItemLabelPlugin/utils/transform2RenderData.js +4 -0
  134. package/libs/PanoMeasurePlugin/Controller/BaseController.d.ts +5 -2
  135. package/libs/PanoMeasurePlugin/Controller/BaseController.js +9 -1
  136. package/libs/PanoMeasurePlugin/Controller/EditController.js +4 -4
  137. package/libs/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
  138. package/libs/PanoMeasurePlugin/Controller/MixedController.js +337 -0
  139. package/libs/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -0
  140. package/libs/PanoMeasurePlugin/Controller/WatchController.js +14 -3
  141. package/libs/PanoMeasurePlugin/Controller/index.d.ts +17 -8
  142. package/libs/PanoMeasurePlugin/Controller/index.js +57 -18
  143. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +1 -1
  144. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +11 -14
  145. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +1 -1
  146. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +1 -1
  147. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +3 -0
  148. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +48 -11
  149. package/libs/PanoMeasurePlugin/Modules/Magnifier.d.ts +49 -14
  150. package/libs/PanoMeasurePlugin/Modules/Magnifier.js +185 -60
  151. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +1 -1
  152. package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
  153. package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.js +98 -0
  154. package/libs/PanoMeasurePlugin/Modules/UIController/index.d.ts +4 -0
  155. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +24 -7
  156. package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
  157. package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.js +80 -0
  158. package/libs/PanoMeasurePlugin/Modules/UIController/style.d.ts +2 -0
  159. package/libs/PanoMeasurePlugin/Modules/UIController/style.js +10 -1
  160. package/libs/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
  161. package/libs/PanoMeasurePlugin/Modules/rangePiece/html.js +64 -0
  162. package/libs/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
  163. package/libs/PanoMeasurePlugin/Modules/rangePiece/index.js +265 -0
  164. package/libs/PanoMeasurePlugin/index.d.ts +8 -5
  165. package/libs/PanoMeasurePlugin/index.js +2 -0
  166. package/libs/PanoMeasurePlugin/typings/data.d.ts +4 -0
  167. package/libs/PanoMeasurePlugin/typings/event.type.d.ts +10 -1
  168. package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
  169. package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.js +15 -0
  170. package/libs/PanoMeasurePlugin/utils/constants.js +7 -7
  171. package/libs/PanoMeasurePlugin/utils/distanceDom.js +19 -14
  172. package/libs/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -2
  173. package/libs/PanoMeasurePlugin/utils/mouseGroup.js +5 -6
  174. package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +3 -3
  175. package/libs/shared-utils/index.d.ts +1 -0
  176. package/libs/shared-utils/index.js +1 -0
  177. package/libs/shared-utils/math/Interval.d.ts +13 -0
  178. package/libs/shared-utils/math/Interval.js +40 -0
  179. package/libs/shared-utils/math/Rectangle.d.ts +27 -0
  180. package/libs/shared-utils/math/Rectangle.js +50 -0
  181. package/libs/shared-utils/math/index.d.ts +2 -0
  182. package/libs/shared-utils/math/index.js +2 -0
  183. package/package.json +2 -1
@@ -42,17 +42,52 @@ 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-1s5p8g", ".item-label-item.svelte-1s5p8g{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;opacity:0}.item-label-item.visible.svelte-1s5p8g{opacity:1;-webkit-animation:svelte-1s5p8g-fadeIn .3s ease-in;animation:svelte-1s5p8g-fadeIn .3s ease-in}.item-label-item__text-wrap.svelte-1s5p8g{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;pointer-events:none;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}.item-label-item__text-wrap.visible.svelte-1s5p8g{pointer-events:all}.icon-wrap.svelte-1s5p8g{width:3.54167rem;height:100%;display:flex;justify-content:center;align-content:center}.icon.svelte-1s5p8g{width:3.54167rem;height:3.54167rem;background-repeat:no-repeat;background-size:contain;background-position:center}.item-label-text.svelte-1s5p8g{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-1s5p8g{white-space:nowrap;font-size:1.14583rem;font-weight:bold;line-height:1.5625rem}.item-name.svelte-1s5p8g{height:auto;word-wrap:break-word;word-break:break-all;font-size:1.04167rem;line-height:1.45833rem}.item-label-item__bar.svelte-1s5p8g{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-1s5p8g: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-1s5p8g-fadeIn{from{opacity:0\n }to{opacity:1\n }}@keyframes svelte-1s5p8g-fadeIn{from{opacity:0\n }to{opacity:1\n }}");
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
- function create_fragment$1(ctx) {
49
- let div5;
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 ?? 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;
54
89
  let t0;
55
- let div2;
90
+ let div0;
56
91
  let span0;
57
92
  let t1_value = (/*itemLabel*/ ctx[0].code ?? /*itemLabel*/ ctx[0].id) + "";
58
93
  let t1;
@@ -60,103 +95,104 @@ function create_fragment$1(ctx) {
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 div4;
66
- let div4_class_value;
67
- let div5_class_value;
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
- div0 = internal.element("div");
110
+ if (if_block) if_block.c();
77
111
  t0 = internal.space();
78
- div2 = internal.element("div");
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
- div4 = internal.element("div");
86
- internal.attr(div0, "class", "icon svelte-1s5p8g");
87
- internal.attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon ?? defaultIcon})`);
88
- internal.attr(div1, "class", "icon-wrap svelte-1s5p8g");
89
- internal.attr(span0, "class", "item-model svelte-1s5p8g");
90
- internal.attr(span1, "class", "item-name svelte-1s5p8g");
91
- internal.attr(div2, "class", "item-label-text svelte-1s5p8g");
92
- internal.attr(div3, "class", div3_class_value = "" + (internal.null_to_empty(classNames__default["default"]("item-label-item__text-wrap", { visible: /*itemLabel*/ ctx[0].visible })) + " svelte-1s5p8g"));
93
- internal.set_style(div3, "bottom", `${/*itemLabel*/ ctx[0].strokeLength}px`);
94
- internal.attr(div4, "class", div4_class_value = "" + (internal.null_to_empty(classNames__default["default"]("item-label-item__bar", { anchor: /*anchorEnabled*/ ctx[1] })) + " svelte-1s5p8g"));
95
- internal.set_style(div4, "height", `${/*itemLabel*/ ctx[0].strokeLength}px`);
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, div5, anchor);
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(div3, t0);
106
- internal.append(div3, div2);
107
- internal.append(div2, span0);
137
+ internal.append(div0, span0);
108
138
  internal.append(span0, t1);
109
- internal.append(div2, t2);
110
- internal.append(div2, span1);
139
+ internal.append(div0, t2);
140
+ internal.append(div0, span1);
111
141
  internal.append(span1, t3);
112
- internal.append(div5, t4);
113
- internal.append(div5, div4);
142
+ internal.append(div3, t4);
143
+ internal.append(div3, div2);
114
144
 
115
145
  if (!mounted) {
116
- dispose = internal.listen(div3, "click", /*onClick*/ ctx[2]);
146
+ dispose = internal.listen(div1, "click", /*onClick*/ ctx[3]);
117
147
  mounted = true;
118
148
  }
119
149
  },
120
150
  p(ctx, [dirty]) {
121
- if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon ?? defaultIcon})`)) {
122
- internal.attr(div0, "style", div0_style_value);
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
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(div3, "bottom", `${/*itemLabel*/ ctx[0].strokeLength}px`);
168
+ internal.set_style(div1, "bottom", `${/*itemLabel*/ ctx[0].strokeLength}px`);
134
169
  }
135
170
 
136
- if (dirty & /*anchorEnabled*/ 2 && div4_class_value !== (div4_class_value = "" + (internal.null_to_empty(classNames__default["default"]("item-label-item__bar", { anchor: /*anchorEnabled*/ ctx[1] })) + " svelte-1s5p8g"))) {
137
- internal.attr(div4, "class", div4_class_value);
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(div4, "height", `${/*itemLabel*/ ctx[0].strokeLength}px`);
176
+ internal.set_style(div2, "height", `${/*itemLabel*/ ctx[0].strokeLength}px`);
142
177
  }
143
178
 
144
- if (dirty & /*itemLabel*/ 1 && div5_class_value !== (div5_class_value = "" + (internal.null_to_empty(classNames__default["default"]("item-label-item", { visible: /*itemLabel*/ ctx[0].visible })) + " svelte-1s5p8g"))) {
145
- internal.attr(div5, "class", div5_class_value);
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(div5, "z-index", /*itemLabel*/ ctx[0].zIndex, false);
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(div5, "transform", /*itemLabel*/ ctx[0].transform, false);
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(div5);
194
+ if (detaching) internal.detach(div3);
195
+ if (if_block) if_block.d();
160
196
  mounted = false;
161
197
  dispose();
162
198
  }
@@ -169,24 +205,42 @@ function instance$1($$self, $$props, $$invalidate) {
169
205
  let { itemLabel } = $$props;
170
206
  let { hooks } = $$props;
171
207
  let { anchorEnabled } = $$props;
208
+ let { onIconClick } = $$props;
172
209
 
173
210
  function onClick() {
174
211
  hooks.emit('onLabelClick', itemLabel);
175
212
  }
176
213
 
214
+ const click_handler = e => onIconClick(itemLabel);
215
+
177
216
  $$self.$$set = $$props => {
178
217
  if ('itemLabel' in $$props) $$invalidate(0, itemLabel = $$props.itemLabel);
179
- if ('hooks' in $$props) $$invalidate(3, hooks = $$props.hooks);
218
+ if ('hooks' in $$props) $$invalidate(4, hooks = $$props.hooks);
180
219
  if ('anchorEnabled' in $$props) $$invalidate(1, anchorEnabled = $$props.anchorEnabled);
220
+ if ('onIconClick' in $$props) $$invalidate(2, onIconClick = $$props.onIconClick);
181
221
  };
182
222
 
183
- return [itemLabel, anchorEnabled, onClick, hooks];
223
+ return [itemLabel, anchorEnabled, onIconClick, onClick, hooks, click_handler];
184
224
  }
185
225
 
186
226
  class ItemLabelItem extends internal.SvelteComponent {
187
227
  constructor(options) {
188
228
  super();
189
- internal.init(this, options, instance$1, create_fragment$1, internal.safe_not_equal, { itemLabel: 0, hooks: 3, anchorEnabled: 1 }, add_css$1);
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
+ );
190
244
  }
191
245
  }
192
246
 
@@ -205,6 +259,43 @@ function debounce(func, wait = 200) {
205
259
  };
206
260
  }
207
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
+
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[28] = list[i];
307
+ child_ctx[31] = list[i];
217
308
  return child_ctx;
218
309
  }
219
310
 
220
- // (163:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
221
- function create_each_block(key_1, ctx) {
222
- let first;
311
+ // (229: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[28],
229
- hooks: /*hooks*/ ctx[1],
230
- anchorEnabled: /*five*/ ctx[0].currentMode === five.Five.Mode.Panorama
318
+ itemLabel: /*itemLabelItem*/ ctx[31],
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[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
+
234
362
  return {
235
363
  key: key_1,
236
364
  first: null,
237
365
  c() {
238
366
  first = internal.empty();
239
- internal.create_component(itemlabelitem.$$.fragment);
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
- internal.mount_component(itemlabelitem, target, anchor);
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
- const itemlabelitem_changes = {};
250
- if (dirty & /*renderItemLabels*/ 4) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[28];
251
- if (dirty & /*hooks*/ 2) itemlabelitem_changes.hooks = /*hooks*/ ctx[1];
252
- if (dirty & /*five*/ 1) itemlabelitem_changes.anchorEnabled = /*five*/ ctx[0].currentMode === five.Five.Mode.Panorama;
253
- itemlabelitem.$set(itemlabelitem_changes);
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
+ }
254
402
  },
255
403
  i(local) {
256
404
  if (current) return;
257
- internal.transition_in(itemlabelitem.$$.fragment, local);
405
+ internal.transition_in(if_block);
258
406
  current = true;
259
407
  },
260
408
  o(local) {
261
- internal.transition_out(itemlabelitem.$$.fragment, local);
409
+ internal.transition_out(if_block);
262
410
  current = false;
263
411
  },
264
412
  d(detaching) {
265
413
  if (detaching) internal.detach(first);
266
- internal.destroy_component(itemlabelitem, detaching);
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[2];
278
- const get_key = ctx => /*itemLabelItem*/ ctx[28].id;
426
+ let each_value = /*renderItemLabels*/ ctx[1];
427
+ const get_key = ctx => /*itemLabelItem*/ ctx[31].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[10].call(div));
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[10].bind(div));
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, [dirty]) {
309
- if (dirty & /*renderItemLabels, hooks, five, Five*/ 7) {
310
- each_value = /*renderItemLabels*/ ctx[2];
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,20 +526,26 @@ function instance($$self, $$props, $$invalidate) {
371
526
  * 1、当前楼层(假设先不考虑多楼层)
372
527
  * 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
373
528
  * */
374
- const getLabelVisible = (five, itemLabel) => {
529
+ const getLabelVisible = (five$1, itemLabel) => {
375
530
  // 虚拟 VR 仅有一层,不考虑楼层信息
376
- const raycaster = new Raycaster();
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
- raycaster.set(cameraPosition.clone(), modelPosition.clone().sub(cameraPosition).normalize());
385
- const [intersection] = five.model.intersectRaycaster(raycaster);
386
- return !(intersection && intersection.distance + 1 < vectorDistance);
387
- };
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);
388
549
 
389
550
  // cssOffset 获取
390
551
  const getLabelCssOffset = (five, itemLabel) => {
@@ -402,23 +563,6 @@ function instance($$self, $$props, $$invalidate) {
402
563
  return [xOffset, yOffset];
403
564
  };
404
565
 
405
- const getLabelTransform = cssOffset => {
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
566
  const getFormatedItemLabels = (five, labels) => {
423
567
  // 计算位置 & 可见性
424
568
  const newLabels = labels.map(label => {
@@ -429,7 +573,7 @@ function instance($$self, $$props, $$invalidate) {
429
573
  // 是否加入碰撞检测
430
574
  const naturalVisible = modelOcclusionEnable
431
575
  ? getLabelVisible(five, label)
432
- : true;
576
+ : label.visible;
433
577
 
434
578
  const visible = naturalVisible;
435
579
 
@@ -459,7 +603,7 @@ function instance($$self, $$props, $$invalidate) {
459
603
 
460
604
  const onItemLabelUpdate = () => {
461
605
  cssOffsetLists = [];
462
- $$invalidate(2, renderItemLabels = getFormatedItemLabels(five, renderItemLabels));
606
+ $$invalidate(1, renderItemLabels = getFormatedItemLabels(five$1, renderItemLabels));
463
607
  };
464
608
 
465
609
  svelte.beforeUpdate(() => {
@@ -472,13 +616,24 @@ function instance($$self, $$props, $$invalidate) {
472
616
  };
473
617
 
474
618
  svelte.onMount(() => {
475
- $$invalidate(2, renderItemLabels = itemLabels);
619
+ $$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
476
620
  curItemLabels = itemLabels;
477
621
  onItemLabelUpdate();
478
622
  addResizeListener();
479
- five.on('cameraUpdate', handleCameraUpdateCallback);
623
+ five$1.on('cameraUpdate', handleCameraUpdateCallback);
624
+ five$1.on('modeChange', onFiveModeChange);
480
625
  });
481
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
+
482
637
  const handleCameraUpdate = debounce(
483
638
  () => {
484
639
  $$invalidate(5, itemsVisible = true);
@@ -498,7 +653,7 @@ function instance($$self, $$props, $$invalidate) {
498
653
 
499
654
  const addDataUpdateListener = () => {
500
655
  if (curItemLabels !== itemLabels) {
501
- $$invalidate(2, renderItemLabels = itemLabels);
656
+ $$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
502
657
  curItemLabels = itemLabels;
503
658
  onItemLabelUpdate();
504
659
  }
@@ -517,10 +672,80 @@ function instance($$self, $$props, $$invalidate) {
517
672
  });
518
673
 
519
674
  svelte.onDestroy(() => {
520
- five.off('cameraUpdate', handleCameraUpdateCallback);
675
+ five$1.off('cameraUpdate', handleCameraUpdateCallback);
676
+ five$1.off('modeChange', onFiveModeChange);
521
677
  resizeObserver.unobserve(wrapper);
522
678
  });
523
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
+
524
749
  function div_elementresize_handler() {
525
750
  containerWidth = this.clientWidth;
526
751
  containerHeight = this.clientHeight;
@@ -529,25 +754,29 @@ function instance($$self, $$props, $$invalidate) {
529
754
  }
530
755
 
531
756
  $$self.$$set = $$props => {
532
- if ('five' in $$props) $$invalidate(0, five = $$props.five);
533
- if ('modelOcclusionEnable' in $$props) $$invalidate(6, modelOcclusionEnable = $$props.modelOcclusionEnable);
534
- if ('itemLabels' in $$props) $$invalidate(7, itemLabels = $$props.itemLabels);
535
- if ('wrapper' in $$props) $$invalidate(8, wrapper = $$props.wrapper);
536
- if ('hooks' in $$props) $$invalidate(1, hooks = $$props.hooks);
537
- if ('displayStrategyType' in $$props) $$invalidate(9, displayStrategyType = $$props.displayStrategyType);
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);
538
764
  };
539
765
 
540
766
  return [
541
- five,
542
767
  hooks,
543
768
  renderItemLabels,
769
+ anchorEnabled,
544
770
  containerWidth,
545
771
  containerHeight,
546
772
  itemsVisible,
773
+ onIconClick,
774
+ five$1,
547
775
  modelOcclusionEnable,
548
776
  itemLabels,
549
777
  wrapper,
550
778
  displayStrategyType,
779
+ maxVisibleDistance,
551
780
  div_elementresize_handler
552
781
  ];
553
782
  }
@@ -563,25 +792,28 @@ class ItemLabelComponent extends internal.SvelteComponent {
563
792
  create_fragment,
564
793
  internal.safe_not_equal,
565
794
  {
566
- five: 0,
567
- modelOcclusionEnable: 6,
568
- itemLabels: 7,
569
- wrapper: 8,
570
- hooks: 1,
571
- displayStrategyType: 9
795
+ five: 7,
796
+ modelOcclusionEnable: 8,
797
+ itemLabels: 9,
798
+ wrapper: 10,
799
+ hooks: 0,
800
+ displayStrategyType: 11,
801
+ maxVisibleDistance: 12
572
802
  },
573
- add_css
803
+ add_css,
804
+ [-1, -1]
574
805
  );
575
806
  }
576
807
  }
577
808
 
578
809
  /** @description 转成内部所需数据 */
579
810
  function parseItemLabelPluginData(data) {
580
- return data.item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1], label.position[2]] }, label)));
811
+ return data.item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined }, label)));
581
812
  }
582
813
 
814
+ const defaultMaxVisibleDistance = undefined;
583
815
  const Plugin = (five$1, params) => {
584
- var _a, _b;
816
+ var _a, _b, _c;
585
817
  const pluginState = {
586
818
  container: document.createElement('div'),
587
819
  data: null,
@@ -593,6 +825,7 @@ const Plugin = (five$1, params) => {
593
825
  hooks: new five.Subscribe(),
594
826
  modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
595
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,
596
829
  };
597
830
  pluginState.container.setAttribute('class', 'item-label-plugin-container');
598
831
  pluginState.container.style.cssText = `
@@ -629,7 +862,6 @@ const Plugin = (five$1, params) => {
629
862
  return true;
630
863
  };
631
864
  const dispose = () => {
632
- removeListener4Five();
633
865
  pluginState.container.remove();
634
866
  };
635
867
  const render = () => {
@@ -652,7 +884,8 @@ const Plugin = (five$1, params) => {
652
884
  itemLabels: pluginState.itemLabels,
653
885
  wrapper: pluginState.wrapper,
654
886
  hooks: pluginState.hooks,
655
- displayStrategyType: pluginState.displayStrategyType
887
+ displayStrategyType: pluginState.displayStrategyType,
888
+ maxVisibleDistance: pluginState.maxVisibleDistance
656
889
  }
657
890
  });
658
891
  }
@@ -665,23 +898,9 @@ const Plugin = (five$1, params) => {
665
898
  };
666
899
  // 添加 five 监听
667
900
  const addListener4Five = () => {
668
- five$1.on('modeChange', onFiveModeChange);
901
+ // five.on('modeChange', onFiveModeChange)
669
902
  five$1.once('dispose', dispose);
670
903
  };
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
904
  addListener4Five();
686
905
  return {
687
906
  appendTo,