@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
@@ -24,12 +24,16 @@ import {
24
24
  } from "svelte/internal";
25
25
 
26
26
  import { Five } from '@realsee/five';
27
- import { ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE } from "./typings";
27
+ import "./typings";
28
28
  import { beforeUpdate, onDestroy, onMount } from "svelte";
29
29
  import * as THREE from 'three';
30
30
  import ItemLabelItem from './ItemLabelItem';
31
31
  import "./events.type";
32
32
  import debounce from '../shared-utils/debounce';
33
+ import { isImpacted } from "./utils/isImpacted";
34
+ import { getStrokeLength } from "./utils/getStrokeLength";
35
+ import { getLabelTransform } from './utils/getLabelTransform';
36
+ import { transform2RenderData } from "./utils/transform2RenderData";
33
37
 
34
38
  function add_css(target) {
35
39
  append_styles(target, "svelte-rmdeb", ".item-labels-container.svelte-rmdeb{width:100%;height:100%;position:relative}");
@@ -37,57 +41,115 @@ function add_css(target) {
37
41
 
38
42
  function get_each_context(ctx, list, i) {
39
43
  const child_ctx = ctx.slice();
40
- child_ctx[28] = list[i];
44
+ child_ctx[31] = list[i];
41
45
  return child_ctx;
42
46
  }
43
47
 
44
- // (163:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
45
- function create_each_block(key_1, ctx) {
46
- let first;
48
+ // (229:2) {#if itemLabelItem.visible}
49
+ function create_if_block(ctx) {
47
50
  let itemlabelitem;
48
51
  let current;
49
52
 
50
53
  itemlabelitem = new ItemLabelItem({
51
54
  props: {
52
- itemLabel: /*itemLabelItem*/ ctx[28],
53
- hooks: /*hooks*/ ctx[1],
54
- anchorEnabled: /*five*/ ctx[0].currentMode === Five.Mode.Panorama
55
+ itemLabel: /*itemLabelItem*/ ctx[31],
56
+ hooks: /*hooks*/ ctx[0],
57
+ anchorEnabled: /*anchorEnabled*/ ctx[2],
58
+ onIconClick: /*onIconClick*/ ctx[6]
55
59
  }
56
60
  });
57
61
 
62
+ return {
63
+ c() {
64
+ create_component(itemlabelitem.$$.fragment);
65
+ },
66
+ m(target, anchor) {
67
+ mount_component(itemlabelitem, target, anchor);
68
+ current = true;
69
+ },
70
+ p(ctx, dirty) {
71
+ const itemlabelitem_changes = {};
72
+ if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[31];
73
+ if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
74
+ if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
75
+ itemlabelitem.$set(itemlabelitem_changes);
76
+ },
77
+ i(local) {
78
+ if (current) return;
79
+ transition_in(itemlabelitem.$$.fragment, local);
80
+ current = true;
81
+ },
82
+ o(local) {
83
+ transition_out(itemlabelitem.$$.fragment, local);
84
+ current = false;
85
+ },
86
+ d(detaching) {
87
+ destroy_component(itemlabelitem, detaching);
88
+ }
89
+ };
90
+ }
91
+
92
+ // (228:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
93
+ function create_each_block(key_1, ctx) {
94
+ let first;
95
+ let if_block_anchor;
96
+ let current;
97
+ let if_block = /*itemLabelItem*/ ctx[31].visible && create_if_block(ctx);
98
+
58
99
  return {
59
100
  key: key_1,
60
101
  first: null,
61
102
  c() {
62
103
  first = empty();
63
- create_component(itemlabelitem.$$.fragment);
104
+ if (if_block) if_block.c();
105
+ if_block_anchor = empty();
64
106
  this.first = first;
65
107
  },
66
108
  m(target, anchor) {
67
109
  insert(target, first, anchor);
68
- mount_component(itemlabelitem, target, anchor);
110
+ if (if_block) if_block.m(target, anchor);
111
+ insert(target, if_block_anchor, anchor);
69
112
  current = true;
70
113
  },
71
114
  p(new_ctx, dirty) {
72
115
  ctx = new_ctx;
73
- const itemlabelitem_changes = {};
74
- if (dirty & /*renderItemLabels*/ 4) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[28];
75
- if (dirty & /*hooks*/ 2) itemlabelitem_changes.hooks = /*hooks*/ ctx[1];
76
- if (dirty & /*five*/ 1) itemlabelitem_changes.anchorEnabled = /*five*/ ctx[0].currentMode === Five.Mode.Panorama;
77
- itemlabelitem.$set(itemlabelitem_changes);
116
+
117
+ if (/*itemLabelItem*/ ctx[31].visible) {
118
+ if (if_block) {
119
+ if_block.p(ctx, dirty);
120
+
121
+ if (dirty[0] & /*renderItemLabels*/ 2) {
122
+ transition_in(if_block, 1);
123
+ }
124
+ } else {
125
+ if_block = create_if_block(ctx);
126
+ if_block.c();
127
+ transition_in(if_block, 1);
128
+ if_block.m(if_block_anchor.parentNode, if_block_anchor);
129
+ }
130
+ } else if (if_block) {
131
+ group_outros();
132
+
133
+ transition_out(if_block, 1, 1, () => {
134
+ if_block = null;
135
+ });
136
+
137
+ check_outros();
138
+ }
78
139
  },
79
140
  i(local) {
80
141
  if (current) return;
81
- transition_in(itemlabelitem.$$.fragment, local);
142
+ transition_in(if_block);
82
143
  current = true;
83
144
  },
84
145
  o(local) {
85
- transition_out(itemlabelitem.$$.fragment, local);
146
+ transition_out(if_block);
86
147
  current = false;
87
148
  },
88
149
  d(detaching) {
89
150
  if (detaching) detach(first);
90
- destroy_component(itemlabelitem, detaching);
151
+ if (if_block) if_block.d(detaching);
152
+ if (detaching) detach(if_block_anchor);
91
153
  }
92
154
  };
93
155
  }
@@ -98,8 +160,8 @@ function create_fragment(ctx) {
98
160
  let each_1_lookup = new Map();
99
161
  let div_resize_listener;
100
162
  let current;
101
- let each_value = /*renderItemLabels*/ ctx[2];
102
- const get_key = ctx => /*itemLabelItem*/ ctx[28].id;
163
+ let each_value = /*renderItemLabels*/ ctx[1];
164
+ const get_key = ctx => /*itemLabelItem*/ ctx[31].id;
103
165
 
104
166
  for (let i = 0; i < each_value.length; i += 1) {
105
167
  let child_ctx = get_each_context(ctx, each_value, i);
@@ -116,7 +178,7 @@ function create_fragment(ctx) {
116
178
  }
117
179
 
118
180
  attr(div, "class", "item-labels-container svelte-rmdeb");
119
- add_render_callback(() => /*div_elementresize_handler*/ ctx[10].call(div));
181
+ add_render_callback(() => /*div_elementresize_handler*/ ctx[13].call(div));
120
182
  set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
121
183
  },
122
184
  m(target, anchor) {
@@ -126,18 +188,18 @@ function create_fragment(ctx) {
126
188
  each_blocks[i].m(div, null);
127
189
  }
128
190
 
129
- div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[10].bind(div));
191
+ div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[13].bind(div));
130
192
  current = true;
131
193
  },
132
- p(ctx, [dirty]) {
133
- if (dirty & /*renderItemLabels, hooks, five, Five*/ 7) {
134
- each_value = /*renderItemLabels*/ ctx[2];
194
+ p(ctx, dirty) {
195
+ if (dirty[0] & /*renderItemLabels, hooks, anchorEnabled, onIconClick*/ 71) {
196
+ each_value = /*renderItemLabels*/ ctx[1];
135
197
  group_outros();
136
198
  each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div, outro_and_destroy_block, create_each_block, null, get_each_context);
137
199
  check_outros();
138
200
  }
139
201
 
140
- if (dirty & /*itemsVisible*/ 32) {
202
+ if (dirty[0] & /*itemsVisible*/ 32) {
141
203
  set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
142
204
  }
143
205
  },
@@ -180,8 +242,14 @@ function instance($$self, $$props, $$invalidate) {
180
242
  let { wrapper } = $$props;
181
243
  let { hooks } = $$props;
182
244
  let { displayStrategyType } = $$props;
245
+ let { maxVisibleDistance } = $$props;
183
246
  let curItemLabels = null;
184
247
  let renderItemLabels = null;
248
+
249
+ let anchorEnabled = (five === null || five === void 0
250
+ ? void 0
251
+ : five.currentMode) === Five.Mode.Panorama;
252
+
185
253
  let wrapperSize = { width: 0, height: 0 };
186
254
  let containerWidth;
187
255
  let containerHeight;
@@ -199,18 +267,24 @@ function instance($$self, $$props, $$invalidate) {
199
267
  * */
200
268
  const getLabelVisible = (five, itemLabel) => {
201
269
  // 虚拟 VR 仅有一层,不考虑楼层信息
202
- const raycaster = new Raycaster();
203
-
204
270
  const cameraPosition = five.camera.position.clone();
271
+
205
272
  const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
206
273
 
207
274
  // 计算点到相机的位置
208
275
  const vectorDistance = modelPosition.distanceTo(cameraPosition);
209
276
 
210
- raycaster.set(cameraPosition.clone(), modelPosition.clone().sub(cameraPosition).normalize());
211
- const [intersection] = five.model.intersectRaycaster(raycaster);
212
- return !(intersection && intersection.distance + 1 < vectorDistance);
213
- };
277
+ // 判断距离,大于最大可见距离直接不可见 TODO 把距离计算和碰撞拆分开
278
+ if (maxVisibleDistance !== undefined && five.state.mode === Five.Mode.Panorama) {
279
+ if (vectorDistance > maxVisibleDistance) {
280
+ return false;
281
+ }
282
+ }
283
+
284
+ return isImpacted(five, modelPosition.clone().sub(cameraPosition).normalize(), cameraPosition, vectorDistance);
285
+ }; // raycaster.set(cameraPosition.clone(), modelPosition.clone().sub(cameraPosition).normalize())
286
+ // const [intersection] = five.model.intersectRaycaster(raycaster)
287
+ // return !(intersection && intersection.distance + 1 < vectorDistance);
214
288
 
215
289
  // cssOffset 获取
216
290
  const getLabelCssOffset = (five, itemLabel) => {
@@ -228,10 +302,6 @@ function instance($$self, $$props, $$invalidate) {
228
302
  return [xOffset, yOffset];
229
303
  };
230
304
 
231
- const getLabelTransform = cssOffset => {
232
- return `translate(${cssOffset[0]}px, ${cssOffset[1]}px)`;
233
- };
234
-
235
305
  // 重叠计算
236
306
  const isOverlap = (cssOffset, widthOffset) => {
237
307
  if (cssOffsetLists.length === 0) {
@@ -242,19 +312,6 @@ function instance($$self, $$props, $$invalidate) {
242
312
  return !!hasOverlapPoint;
243
313
  };
244
314
 
245
- function getStrokeLength(itemSpaceHeight, type) {
246
- switch (type) {
247
- case ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL:
248
- return Math.ceil(-27.78 * itemSpaceHeight + 85);
249
- case ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.MIDLLE:
250
- return Math.ceil(-38.9 * itemSpaceHeight + 130);
251
- case ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.LARGE:
252
- return Math.ceil(-44.44 * itemSpaceHeight + 140);
253
- case ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.EXTRA_LARGE:
254
- return Math.ceil(-92.59 * itemSpaceHeight + 300);
255
- }
256
- }
257
-
258
315
  const getFormatedItemLabels = (five, labels) => {
259
316
  // 计算位置 & 可见性
260
317
  const newLabels = labels.map(label => {
@@ -265,7 +322,7 @@ function instance($$self, $$props, $$invalidate) {
265
322
  // 是否加入碰撞检测
266
323
  const naturalVisible = modelOcclusionEnable
267
324
  ? getLabelVisible(five, label)
268
- : true;
325
+ : label.visible;
269
326
 
270
327
  const visible = naturalVisible;
271
328
 
@@ -295,7 +352,7 @@ function instance($$self, $$props, $$invalidate) {
295
352
 
296
353
  const onItemLabelUpdate = () => {
297
354
  cssOffsetLists = [];
298
- $$invalidate(2, renderItemLabels = getFormatedItemLabels(five, renderItemLabels));
355
+ $$invalidate(1, renderItemLabels = getFormatedItemLabels(five, renderItemLabels));
299
356
  };
300
357
 
301
358
  beforeUpdate(() => {
@@ -308,13 +365,24 @@ function instance($$self, $$props, $$invalidate) {
308
365
  };
309
366
 
310
367
  onMount(() => {
311
- $$invalidate(2, renderItemLabels = itemLabels);
368
+ $$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
312
369
  curItemLabels = itemLabels;
313
370
  onItemLabelUpdate();
314
371
  addResizeListener();
315
372
  five.on('cameraUpdate', handleCameraUpdateCallback);
373
+ five.on('modeChange', onFiveModeChange);
316
374
  });
317
375
 
376
+ const onFiveModeChange = mode => {
377
+ $$invalidate(5, itemsVisible = false);
378
+
379
+ five.once('initAnimationEnded', (panoIndex, pose, userAction) => {
380
+ $$invalidate(2, anchorEnabled = mode === Five.Mode.Panorama);
381
+ $$invalidate(5, itemsVisible = true);
382
+ if (!userAction) return; else onItemLabelUpdate();
383
+ });
384
+ };
385
+
318
386
  const handleCameraUpdate = debounce(
319
387
  () => {
320
388
  $$invalidate(5, itemsVisible = true);
@@ -334,7 +402,7 @@ function instance($$self, $$props, $$invalidate) {
334
402
 
335
403
  const addDataUpdateListener = () => {
336
404
  if (curItemLabels !== itemLabels) {
337
- $$invalidate(2, renderItemLabels = itemLabels);
405
+ $$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
338
406
  curItemLabels = itemLabels;
339
407
  onItemLabelUpdate();
340
408
  }
@@ -354,9 +422,79 @@ function instance($$self, $$props, $$invalidate) {
354
422
 
355
423
  onDestroy(() => {
356
424
  five.off('cameraUpdate', handleCameraUpdateCallback);
425
+ five.off('modeChange', onFiveModeChange);
357
426
  resizeObserver.unobserve(wrapper);
358
427
  });
359
428
 
429
+ const getNearObserverPano = (fromPositionVector, observers) => {
430
+ let candidates = [];
431
+
432
+ for (let i = 0; i < observers.length; i++) {
433
+ const { position: obVector, panoIndex } = observers[i];
434
+ const distance = fromPositionVector.distanceTo(obVector);
435
+
436
+ if (maxVisibleDistance === undefined || distance <= maxVisibleDistance || five.state.mode !== Five.Mode.Panorama) {
437
+ candidates.push({ panoIndex, obVector, distance });
438
+ }
439
+ }
440
+
441
+ candidates = candidates.sort((a, b) => a.distance - b.distance);
442
+ let observerIndex;
443
+
444
+ for (let i = 0; i < candidates.length; i++) {
445
+ const { obVector, distance, panoIndex } = candidates[i];
446
+ const isImpactedRes = isImpacted(five, fromPositionVector, obVector, distance);
447
+
448
+ if (!isImpactedRes) {
449
+ observerIndex = panoIndex;
450
+ break;
451
+ }
452
+ }
453
+
454
+ return typeof observerIndex === "number"
455
+ ? observers[observerIndex]
456
+ : undefined;
457
+ };
458
+
459
+ const onIconClick = itemLabel => {
460
+ if (five.state.mode === Five.Mode.Panorama) return;
461
+ const observers = five.work.observers;
462
+ const fromPositionVector = new Vector3(itemLabel.position[0], itemLabel.position[1], itemLabel.position[2]);
463
+ const observer = getNearObserverPano(fromPositionVector, observers);
464
+
465
+ if (observer) {
466
+ itemLabel.observerIndex = observer.panoIndex;
467
+ }
468
+
469
+ if (typeof itemLabel.observerIndex === "number") {
470
+ const observer = observers[itemLabel.observerIndex];
471
+ const direction = fromPositionVector.clone().sub(observer.position).normalize();
472
+
473
+ const cameraCoord = {
474
+ longitude: Math.PI + Math.atan2(direction.x, direction.z),
475
+ latitude: Math.acos(direction.y / direction.length()) - Math.PI / 2
476
+ };
477
+
478
+ five.setState(Object.assign(Object.assign({}, cameraCoord), {
479
+ mode: Five.Mode.Panorama,
480
+ panoIndex: itemLabel.observerIndex
481
+ }));
482
+
483
+ // 游走结束更新 render list
484
+ five.once('initAnimationEnded', () => {
485
+ $$invalidate(1, renderItemLabels = renderItemLabels.map(item => {
486
+ return Object.assign(Object.assign({}, item), { isFold: item.id !== itemLabel.id });
487
+ }));
488
+
489
+ five.once('cameraUpdate', () => {
490
+ $$invalidate(1, renderItemLabels = renderItemLabels.map(item => {
491
+ return Object.assign(Object.assign({}, item), { isFold: false });
492
+ }));
493
+ });
494
+ });
495
+ }
496
+ };
497
+
360
498
  function div_elementresize_handler() {
361
499
  containerWidth = this.clientWidth;
362
500
  containerHeight = this.clientHeight;
@@ -365,25 +503,29 @@ function instance($$self, $$props, $$invalidate) {
365
503
  }
366
504
 
367
505
  $$self.$$set = $$props => {
368
- if ('five' in $$props) $$invalidate(0, five = $$props.five);
369
- if ('modelOcclusionEnable' in $$props) $$invalidate(6, modelOcclusionEnable = $$props.modelOcclusionEnable);
370
- if ('itemLabels' in $$props) $$invalidate(7, itemLabels = $$props.itemLabels);
371
- if ('wrapper' in $$props) $$invalidate(8, wrapper = $$props.wrapper);
372
- if ('hooks' in $$props) $$invalidate(1, hooks = $$props.hooks);
373
- if ('displayStrategyType' in $$props) $$invalidate(9, displayStrategyType = $$props.displayStrategyType);
506
+ if ('five' in $$props) $$invalidate(7, five = $$props.five);
507
+ if ('modelOcclusionEnable' in $$props) $$invalidate(8, modelOcclusionEnable = $$props.modelOcclusionEnable);
508
+ if ('itemLabels' in $$props) $$invalidate(9, itemLabels = $$props.itemLabels);
509
+ if ('wrapper' in $$props) $$invalidate(10, wrapper = $$props.wrapper);
510
+ if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
511
+ if ('displayStrategyType' in $$props) $$invalidate(11, displayStrategyType = $$props.displayStrategyType);
512
+ if ('maxVisibleDistance' in $$props) $$invalidate(12, maxVisibleDistance = $$props.maxVisibleDistance);
374
513
  };
375
514
 
376
515
  return [
377
- five,
378
516
  hooks,
379
517
  renderItemLabels,
518
+ anchorEnabled,
380
519
  containerWidth,
381
520
  containerHeight,
382
521
  itemsVisible,
522
+ onIconClick,
523
+ five,
383
524
  modelOcclusionEnable,
384
525
  itemLabels,
385
526
  wrapper,
386
527
  displayStrategyType,
528
+ maxVisibleDistance,
387
529
  div_elementresize_handler
388
530
  ];
389
531
  }
@@ -399,14 +541,16 @@ class Component extends SvelteComponent {
399
541
  create_fragment,
400
542
  safe_not_equal,
401
543
  {
402
- five: 0,
403
- modelOcclusionEnable: 6,
404
- itemLabels: 7,
405
- wrapper: 8,
406
- hooks: 1,
407
- displayStrategyType: 9
544
+ five: 7,
545
+ modelOcclusionEnable: 8,
546
+ itemLabels: 9,
547
+ wrapper: 10,
548
+ hooks: 0,
549
+ displayStrategyType: 11,
550
+ maxVisibleDistance: 12
408
551
  },
409
- add_css
552
+ add_css,
553
+ [-1, -1]
410
554
  );
411
555
  }
412
556
  }