@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,558 @@
1
+ /* generated by Svelte v3.47.0 */
2
+ import {
3
+ SvelteComponent,
4
+ add_render_callback,
5
+ add_resize_listener,
6
+ append_styles,
7
+ attr,
8
+ check_outros,
9
+ create_component,
10
+ destroy_component,
11
+ detach,
12
+ element,
13
+ empty,
14
+ group_outros,
15
+ init,
16
+ insert,
17
+ mount_component,
18
+ outro_and_destroy_block,
19
+ safe_not_equal,
20
+ set_style,
21
+ transition_in,
22
+ transition_out,
23
+ update_keyed_each
24
+ } from "svelte/internal";
25
+
26
+ import { Five } from '@realsee/five';
27
+ import "./typings";
28
+ import { beforeUpdate, onDestroy, onMount } from "svelte";
29
+ import * as THREE from 'three';
30
+ import ItemLabelItem from './ItemLabelItem';
31
+ import "./events.type";
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";
37
+
38
+ function add_css(target) {
39
+ append_styles(target, "svelte-rmdeb", ".item-labels-container.svelte-rmdeb{width:100%;height:100%;position:relative}");
40
+ }
41
+
42
+ function get_each_context(ctx, list, i) {
43
+ const child_ctx = ctx.slice();
44
+ child_ctx[31] = list[i];
45
+ return child_ctx;
46
+ }
47
+
48
+ // (229:2) {#if itemLabelItem.visible}
49
+ function create_if_block(ctx) {
50
+ let itemlabelitem;
51
+ let current;
52
+
53
+ itemlabelitem = new ItemLabelItem({
54
+ props: {
55
+ itemLabel: /*itemLabelItem*/ ctx[31],
56
+ hooks: /*hooks*/ ctx[0],
57
+ anchorEnabled: /*anchorEnabled*/ ctx[2],
58
+ onIconClick: /*onIconClick*/ ctx[6]
59
+ }
60
+ });
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
+
99
+ return {
100
+ key: key_1,
101
+ first: null,
102
+ c() {
103
+ first = empty();
104
+ if (if_block) if_block.c();
105
+ if_block_anchor = empty();
106
+ this.first = first;
107
+ },
108
+ m(target, anchor) {
109
+ insert(target, first, anchor);
110
+ if (if_block) if_block.m(target, anchor);
111
+ insert(target, if_block_anchor, anchor);
112
+ current = true;
113
+ },
114
+ p(new_ctx, dirty) {
115
+ ctx = new_ctx;
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
+ }
139
+ },
140
+ i(local) {
141
+ if (current) return;
142
+ transition_in(if_block);
143
+ current = true;
144
+ },
145
+ o(local) {
146
+ transition_out(if_block);
147
+ current = false;
148
+ },
149
+ d(detaching) {
150
+ if (detaching) detach(first);
151
+ if (if_block) if_block.d(detaching);
152
+ if (detaching) detach(if_block_anchor);
153
+ }
154
+ };
155
+ }
156
+
157
+ function create_fragment(ctx) {
158
+ let div;
159
+ let each_blocks = [];
160
+ let each_1_lookup = new Map();
161
+ let div_resize_listener;
162
+ let current;
163
+ let each_value = /*renderItemLabels*/ ctx[1];
164
+ const get_key = ctx => /*itemLabelItem*/ ctx[31].id;
165
+
166
+ for (let i = 0; i < each_value.length; i += 1) {
167
+ let child_ctx = get_each_context(ctx, each_value, i);
168
+ let key = get_key(child_ctx);
169
+ each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx));
170
+ }
171
+
172
+ return {
173
+ c() {
174
+ div = element("div");
175
+
176
+ for (let i = 0; i < each_blocks.length; i += 1) {
177
+ each_blocks[i].c();
178
+ }
179
+
180
+ attr(div, "class", "item-labels-container svelte-rmdeb");
181
+ add_render_callback(() => /*div_elementresize_handler*/ ctx[13].call(div));
182
+ set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
183
+ },
184
+ m(target, anchor) {
185
+ insert(target, div, anchor);
186
+
187
+ for (let i = 0; i < each_blocks.length; i += 1) {
188
+ each_blocks[i].m(div, null);
189
+ }
190
+
191
+ div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[13].bind(div));
192
+ current = true;
193
+ },
194
+ p(ctx, dirty) {
195
+ if (dirty[0] & /*renderItemLabels, hooks, anchorEnabled, onIconClick*/ 71) {
196
+ each_value = /*renderItemLabels*/ ctx[1];
197
+ group_outros();
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);
199
+ check_outros();
200
+ }
201
+
202
+ if (dirty[0] & /*itemsVisible*/ 32) {
203
+ set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
204
+ }
205
+ },
206
+ i(local) {
207
+ if (current) return;
208
+
209
+ for (let i = 0; i < each_value.length; i += 1) {
210
+ transition_in(each_blocks[i]);
211
+ }
212
+
213
+ current = true;
214
+ },
215
+ o(local) {
216
+ for (let i = 0; i < each_blocks.length; i += 1) {
217
+ transition_out(each_blocks[i]);
218
+ }
219
+
220
+ current = false;
221
+ },
222
+ d(detaching) {
223
+ if (detaching) detach(div);
224
+
225
+ for (let i = 0; i < each_blocks.length; i += 1) {
226
+ each_blocks[i].d();
227
+ }
228
+
229
+ div_resize_listener();
230
+ }
231
+ };
232
+ }
233
+
234
+ let cssHeight = 26;
235
+ let basicWidth = 11;
236
+
237
+ function instance($$self, $$props, $$invalidate) {
238
+ const { Raycaster, Vector3 } = THREE;
239
+ let { five } = $$props;
240
+ let { modelOcclusionEnable } = $$props;
241
+ let { itemLabels } = $$props;
242
+ let { wrapper } = $$props;
243
+ let { hooks } = $$props;
244
+ let { displayStrategyType } = $$props;
245
+ let { maxVisibleDistance } = $$props;
246
+ let curItemLabels = null;
247
+ let renderItemLabels = null;
248
+
249
+ let anchorEnabled = (five === null || five === void 0
250
+ ? void 0
251
+ : five.currentMode) === Five.Mode.Panorama;
252
+
253
+ let wrapperSize = { width: 0, height: 0 };
254
+ let containerWidth;
255
+ let containerHeight;
256
+
257
+ // 计算重叠
258
+ let cssOffsetLists = [];
259
+
260
+ // 动画过程中 itemsVisible 为 false
261
+ let itemsVisible = true;
262
+
263
+ /**
264
+ * 可见性策略:
265
+ * 1、当前楼层(假设先不考虑多楼层)
266
+ * 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
267
+ * */
268
+ const getLabelVisible = (five, itemLabel) => {
269
+ // 虚拟 VR 仅有一层,不考虑楼层信息
270
+ const cameraPosition = five.camera.position.clone();
271
+
272
+ const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
273
+
274
+ // 计算点到相机的位置
275
+ const vectorDistance = modelPosition.distanceTo(cameraPosition);
276
+
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);
288
+
289
+ // cssOffset 获取
290
+ const getLabelCssOffset = (five, itemLabel) => {
291
+ const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
292
+ const cssPosition = five.project2d(modelPosition);
293
+
294
+ const xOffset = cssPosition === null || cssPosition === void 0
295
+ ? void 0
296
+ : cssPosition.x;
297
+
298
+ const yOffset = cssPosition === null || cssPosition === void 0
299
+ ? void 0
300
+ : cssPosition.y;
301
+
302
+ return [xOffset, yOffset];
303
+ };
304
+
305
+ // 重叠计算
306
+ const isOverlap = (cssOffset, widthOffset) => {
307
+ if (cssOffsetLists.length === 0) {
308
+ return false;
309
+ }
310
+
311
+ const hasOverlapPoint = cssOffsetLists.find(item => cssOffset[0] >= item[0] - widthOffset && cssOffset[0] <= item[0] + widthOffset || cssOffset[1] >= item[1] - cssHeight && cssOffset[1] <= item[1] + cssHeight);
312
+ return !!hasOverlapPoint;
313
+ };
314
+
315
+ const getFormatedItemLabels = (five, labels) => {
316
+ // 计算位置 & 可见性
317
+ const newLabels = labels.map(label => {
318
+ const cssOffset = getLabelCssOffset(five, label);
319
+ const curLabelWidth = label.name.length * basicWidth;
320
+ const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
321
+
322
+ // 是否加入碰撞检测
323
+ const naturalVisible = modelOcclusionEnable
324
+ ? getLabelVisible(five, label)
325
+ : label.visible;
326
+
327
+ const visible = naturalVisible;
328
+
329
+ // 关掉重叠计算
330
+ // const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth)
331
+ if (!visible) return Object.assign(Object.assign({}, label), { visible });
332
+
333
+ cssOffsetLists.push(cssOffset);
334
+
335
+ // position
336
+ const transform = getLabelTransform(cssOffset);
337
+
338
+ return Object.assign(Object.assign({}, label), { visible, transform, strokeLength });
339
+ });
340
+
341
+ const sortedItemLabelItems = newLabels.filter(({ visible }) => visible).map(label => ({
342
+ itemLabelItem: label,
343
+ distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five.camera.position)
344
+ })).sort((a, b) => a.distance - b.distance);
345
+
346
+ return newLabels.map(label => {
347
+ const sortIndex = sortedItemLabelItems.findIndex(item => item.itemLabelItem.id === label.id);
348
+ if (sortIndex !== undefined) return Object.assign(Object.assign({}, label), { zIndex: sortIndex * 10 });
349
+ return label;
350
+ });
351
+ };
352
+
353
+ const onItemLabelUpdate = () => {
354
+ cssOffsetLists = [];
355
+ $$invalidate(1, renderItemLabels = getFormatedItemLabels(five, renderItemLabels));
356
+ };
357
+
358
+ beforeUpdate(() => {
359
+ addDataUpdateListener();
360
+ });
361
+
362
+ const handleCameraUpdateCallback = () => {
363
+ $$invalidate(5, itemsVisible = false);
364
+ handleCameraUpdate();
365
+ };
366
+
367
+ onMount(() => {
368
+ $$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
369
+ curItemLabels = itemLabels;
370
+ onItemLabelUpdate();
371
+ addResizeListener();
372
+ five.on('cameraUpdate', handleCameraUpdateCallback);
373
+ five.on('modeChange', onFiveModeChange);
374
+ });
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
+
386
+ const handleCameraUpdate = debounce(
387
+ () => {
388
+ $$invalidate(5, itemsVisible = true);
389
+ onItemLabelUpdate();
390
+ },
391
+ 300
392
+ );
393
+
394
+ const addResizeListener = () => {
395
+ wrapperSize = {
396
+ width: wrapper.clientWidth,
397
+ height: wrapper.clientHeight
398
+ };
399
+
400
+ resizeObserver.observe(wrapper);
401
+ };
402
+
403
+ const addDataUpdateListener = () => {
404
+ if (curItemLabels !== itemLabels) {
405
+ $$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
406
+ curItemLabels = itemLabels;
407
+ onItemLabelUpdate();
408
+ }
409
+ };
410
+
411
+ const resizeObserver = new ResizeObserver(entries => {
412
+ const entry = entries[0];
413
+ const target = entry.target;
414
+ const curWidth = target.clientWidth;
415
+ const curHeight = target.clientHeight;
416
+
417
+ if (wrapperSize.width !== curWidth || wrapperSize.height !== curHeight) {
418
+ wrapperSize = { width: curWidth, height: curHeight };
419
+ onItemLabelUpdate();
420
+ }
421
+ });
422
+
423
+ onDestroy(() => {
424
+ five.off('cameraUpdate', handleCameraUpdateCallback);
425
+ five.off('modeChange', onFiveModeChange);
426
+ resizeObserver.unobserve(wrapper);
427
+ });
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
+
498
+ function div_elementresize_handler() {
499
+ containerWidth = this.clientWidth;
500
+ containerHeight = this.clientHeight;
501
+ $$invalidate(3, containerWidth);
502
+ $$invalidate(4, containerHeight);
503
+ }
504
+
505
+ $$self.$$set = $$props => {
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);
513
+ };
514
+
515
+ return [
516
+ hooks,
517
+ renderItemLabels,
518
+ anchorEnabled,
519
+ containerWidth,
520
+ containerHeight,
521
+ itemsVisible,
522
+ onIconClick,
523
+ five,
524
+ modelOcclusionEnable,
525
+ itemLabels,
526
+ wrapper,
527
+ displayStrategyType,
528
+ maxVisibleDistance,
529
+ div_elementresize_handler
530
+ ];
531
+ }
532
+
533
+ class Component extends SvelteComponent {
534
+ constructor(options) {
535
+ super();
536
+
537
+ init(
538
+ this,
539
+ options,
540
+ instance,
541
+ create_fragment,
542
+ safe_not_equal,
543
+ {
544
+ five: 7,
545
+ modelOcclusionEnable: 8,
546
+ itemLabels: 9,
547
+ wrapper: 10,
548
+ hooks: 0,
549
+ displayStrategyType: 11,
550
+ maxVisibleDistance: 12
551
+ },
552
+ add_css,
553
+ [-1, -1]
554
+ );
555
+ }
556
+ }
557
+
558
+ export default Component;