@mattilsynet/design 3.3.9 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mtds/_virtual/_rolldown/runtime.js +17 -0
- package/mtds/ai/card.stories.tsx +54 -77
- package/mtds/ai/layout.mdx +37 -1
- package/mtds/ai/layout.stories.tsx +126 -1
- package/mtds/ai/print.mdx +1 -1
- package/mtds/ai/print.stories.tsx +1 -2
- package/mtds/alert/alert.js +16 -11
- package/mtds/alert/alert.js.map +1 -1
- package/mtds/analytics/analytics.js +118 -118
- package/mtds/analytics/analytics.js.map +1 -1
- package/mtds/app/app-observer.js +31 -36
- package/mtds/app/app-observer.js.map +1 -1
- package/mtds/app/app-toggle.js +12 -26
- package/mtds/app/app-toggle.js.map +1 -1
- package/mtds/app/app-toggle2.js +6 -11
- package/mtds/app/app-toggle2.js.map +1 -1
- package/mtds/app/app.js +66 -60
- package/mtds/app/app.js.map +1 -1
- package/mtds/atlas/atlas-element.js +83 -93
- package/mtds/atlas/atlas-element.js.map +1 -1
- package/mtds/atlas/atlas-marker.js +63 -52
- package/mtds/atlas/atlas-marker.js.map +1 -1
- package/mtds/atlas/atlas-matgeo.js +67 -61
- package/mtds/atlas/atlas-matgeo.js.map +1 -1
- package/mtds/atlas/atlas-wms.js +33 -28
- package/mtds/atlas/atlas-wms.js.map +1 -1
- package/mtds/atlas/atlas.js +6 -38
- package/mtds/atlas/atlas.js.map +1 -1
- package/mtds/atlas/atlas2.js +39 -0
- package/mtds/atlas/atlas2.js.map +1 -0
- package/mtds/atlas/cluster.js +759 -1149
- package/mtds/atlas/cluster.js.map +1 -1
- package/mtds/atlas.iife.js +3 -4
- package/mtds/atlas.js +6 -14
- package/mtds/avatar/avatar.js +14 -10
- package/mtds/avatar/avatar.js.map +1 -1
- package/mtds/badge/badge.js +15 -10
- package/mtds/badge/badge.js.map +1 -1
- package/mtds/breadcrumbs/breadcrumbs.js +15 -19
- package/mtds/breadcrumbs/breadcrumbs.js.map +1 -1
- package/mtds/button/button.js +18 -20
- package/mtds/button/button.js.map +1 -1
- package/mtds/card/card.js +22 -15
- package/mtds/card/card.js.map +1 -1
- package/mtds/chart/chart-axis.js +33 -21
- package/mtds/chart/chart-axis.js.map +1 -1
- package/mtds/chart/chart-bars.js +23 -21
- package/mtds/chart/chart-bars.js.map +1 -1
- package/mtds/chart/chart-element.js +94 -88
- package/mtds/chart/chart-element.js.map +1 -1
- package/mtds/chart/chart-lines.js +35 -37
- package/mtds/chart/chart-lines.js.map +1 -1
- package/mtds/chart/chart-pies.js +17 -17
- package/mtds/chart/chart-pies.js.map +1 -1
- package/mtds/chart/chart.js +6 -52
- package/mtds/chart/chart.js.map +1 -1
- package/mtds/chart/chart2.js +21 -0
- package/mtds/chart/chart2.js.map +1 -0
- package/mtds/chip/chip.js +15 -11
- package/mtds/chip/chip.js.map +1 -1
- package/mtds/deprecations.js +76 -158
- package/mtds/deprecations.js.map +1 -1
- package/mtds/details/details.js +21 -24
- package/mtds/details/details.js.map +1 -1
- package/mtds/dialog/dialog.js +17 -21
- package/mtds/dialog/dialog.js.map +1 -1
- package/mtds/divider/divider.js +15 -20
- package/mtds/divider/divider.js.map +1 -1
- package/mtds/errorsummary/errorsummary.js +14 -16
- package/mtds/errorsummary/errorsummary.js.map +1 -1
- package/mtds/external/@turf/boolean-point-in-polygon/dist/esm/index.js +22 -25
- package/mtds/external/@turf/boolean-point-in-polygon/dist/esm/index.js.map +1 -1
- package/mtds/external/@turf/helpers/dist/esm/index.js +21 -24
- package/mtds/external/@turf/helpers/dist/esm/index.js.map +1 -1
- package/mtds/external/@turf/invariant/dist/esm/index.js +15 -19
- package/mtds/external/@turf/invariant/dist/esm/index.js.map +1 -1
- package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js +270 -297
- package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js.map +1 -1
- package/mtds/external/@u-elements/u-details/dist/u-details.js +75 -101
- package/mtds/external/@u-elements/u-details/dist/u-details.js.map +1 -1
- package/mtds/external/leaflet/dist/leaflet-src.js +4257 -6151
- package/mtds/external/leaflet/dist/leaflet-src.js.map +1 -1
- package/mtds/external/leaflet/dist/leaflet.css.js +5 -606
- package/mtds/external/leaflet/dist/leaflet.css.js.map +1 -1
- package/mtds/external/point-in-polygon-hao/dist/esm/index.js +24 -25
- package/mtds/external/point-in-polygon-hao/dist/esm/index.js.map +1 -1
- package/mtds/external/robust-predicates/esm/incircle.js +5 -0
- package/mtds/external/robust-predicates/esm/incircle.js.map +1 -0
- package/mtds/external/robust-predicates/esm/insphere.js +5 -0
- package/mtds/external/robust-predicates/esm/insphere.js.map +1 -0
- package/mtds/external/robust-predicates/esm/orient2d.js +20 -22
- package/mtds/external/robust-predicates/esm/orient2d.js.map +1 -1
- package/mtds/external/robust-predicates/esm/orient3d.js +5 -0
- package/mtds/external/robust-predicates/esm/orient3d.js.map +1 -0
- package/mtds/external/robust-predicates/esm/util.js +20 -28
- package/mtds/external/robust-predicates/esm/util.js.map +1 -1
- package/mtds/external/robust-predicates/index.js +5 -0
- package/mtds/field/field.js +167 -214
- package/mtds/field/field.js.map +1 -1
- package/mtds/fieldset/fieldset.js +32 -30
- package/mtds/fieldset/fieldset.js.map +1 -1
- package/mtds/fileupload/fileupload.js +16 -13
- package/mtds/fileupload/fileupload.js.map +1 -1
- package/mtds/helptext/helptext.js +25 -27
- package/mtds/helptext/helptext.js.map +1 -1
- package/mtds/identitet/illustrasjons-generator/illustrasjons-generator.d.ts +1 -0
- package/mtds/identitet/illustrasjons-generator/index-old-1.d.ts +1 -0
- package/mtds/identitet/infografikk-generator/infografikk-generator.d.ts +1 -0
- package/mtds/illustrations/index.json +1 -1
- package/mtds/index.iife.js +21 -21
- package/mtds/index.js +38 -31
- package/mtds/index.js.map +1 -1
- package/mtds/input/input.js +33 -47
- package/mtds/input/input.js.map +1 -1
- package/mtds/law/law-helper.js +106 -95
- package/mtds/law/law-helper.js.map +1 -1
- package/mtds/law/law.js +15 -10
- package/mtds/law/law.js.map +1 -1
- package/mtds/layout/layout.js +21 -13
- package/mtds/layout/layout.js.map +1 -1
- package/mtds/layout/layout.stories.d.ts +1 -0
- package/mtds/link/link.js +15 -10
- package/mtds/link/link.js.map +1 -1
- package/mtds/logo/logo-observer.js +18 -18
- package/mtds/logo/logo-observer.js.map +1 -1
- package/mtds/logo/logo.js +18 -18
- package/mtds/logo/logo.js.map +1 -1
- package/mtds/package.js +6 -0
- package/mtds/package.js.map +1 -0
- package/mtds/package.json.d.ts +112 -0
- package/mtds/pagination/pagination.js +46 -60
- package/mtds/pagination/pagination.js.map +1 -1
- package/mtds/popover/popover-observer.js +15 -15
- package/mtds/popover/popover-observer.js.map +1 -1
- package/mtds/popover/popover.js +18 -20
- package/mtds/popover/popover.js.map +1 -1
- package/mtds/print/print.js +15 -10
- package/mtds/print/print.js.map +1 -1
- package/mtds/print/print.stories.d.ts +0 -1
- package/mtds/profilering/epost.d.ts +1 -0
- package/mtds/progress/progress.js +15 -13
- package/mtds/progress/progress.js.map +1 -1
- package/mtds/react-atlas.js +7 -16
- package/mtds/react.js +36 -84
- package/mtds/skeleton/skeleton.js +15 -11
- package/mtds/skeleton/skeleton.js.map +1 -1
- package/mtds/spinner/spinner.js +16 -13
- package/mtds/spinner/spinner.js.map +1 -1
- package/mtds/steps/steps.js +15 -10
- package/mtds/steps/steps.js.map +1 -1
- package/mtds/styles.css +2 -1
- package/mtds/styles.module.js +122 -0
- package/mtds/styles.module.js.map +1 -0
- package/mtds/table/table-observer.js +23 -28
- package/mtds/table/table-observer.js.map +1 -1
- package/mtds/table/table.js +88 -60
- package/mtds/table/table.js.map +1 -1
- package/mtds/tabs/tabs.js +32 -27
- package/mtds/tabs/tabs.js.map +1 -1
- package/mtds/tag/tag.js +16 -19
- package/mtds/tag/tag.js.map +1 -1
- package/mtds/tailwind.css +0 -4
- package/mtds/toast/toast-helper.js +45 -25
- package/mtds/toast/toast-helper.js.map +1 -1
- package/mtds/toast/toast-observer.js +18 -18
- package/mtds/toast/toast-observer.js.map +1 -1
- package/mtds/toast/toast.js +67 -54
- package/mtds/toast/toast.js.map +1 -1
- package/mtds/togglegroup/togglegroup.js +31 -40
- package/mtds/togglegroup/togglegroup.js.map +1 -1
- package/mtds/tooltip/tooltip-element.js +12 -25
- package/mtds/tooltip/tooltip-element.js.map +1 -1
- package/mtds/typography/typography.js +38 -21
- package/mtds/typography/typography.js.map +1 -1
- package/mtds/utils.js +53 -70
- package/mtds/utils.js.map +1 -1
- package/mtds/validation/validation-observer.js +40 -47
- package/mtds/validation/validation-observer.js.map +1 -1
- package/mtds/validation/validation.js +17 -21
- package/mtds/validation/validation.js.map +1 -1
- package/package.json +9 -9
- package/mtds/atlas/atlas.css.js +0 -138
- package/mtds/atlas/atlas.css.js.map +0 -1
- package/mtds/atlas.js.map +0 -1
- package/mtds/chart/chart.css.js +0 -187
- package/mtds/chart/chart.css.js.map +0 -1
- package/mtds/package.json.js +0 -5
- package/mtds/package.json.js.map +0 -1
- package/mtds/react-atlas.js.map +0 -1
- package/mtds/react.js.map +0 -1
- package/mtds/styles.module.css.js +0 -118
- package/mtds/styles.module.css.js.map +0 -1
package/mtds/atlas/cluster.js
CHANGED
|
@@ -1,1149 +1,759 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
e,
|
|
761
|
-
(n) => {
|
|
762
|
-
if (e !== n._zoom)
|
|
763
|
-
for (let s = n._markers.length - 1; s >= 0; s--) {
|
|
764
|
-
const o = n._markers[s];
|
|
765
|
-
i.contains(o._latlng) && (t && (o._backupLatlng = o.getLatLng(), o.setLatLng(t), o.clusterHide && o.clusterHide()), n._group._featureGroup.addLayer(o));
|
|
766
|
-
}
|
|
767
|
-
},
|
|
768
|
-
(n) => {
|
|
769
|
-
n._addToMap(t);
|
|
770
|
-
}
|
|
771
|
-
);
|
|
772
|
-
},
|
|
773
|
-
_recursivelyRestoreChildPositions: function(t) {
|
|
774
|
-
for (let e = this._markers.length - 1; e >= 0; e--) {
|
|
775
|
-
const i = this._markers[e];
|
|
776
|
-
i._backupLatlng && (i.setLatLng(i._backupLatlng), delete i._backupLatlng);
|
|
777
|
-
}
|
|
778
|
-
if (t - 1 === this._zoom)
|
|
779
|
-
for (let e = this._childClusters.length - 1; e >= 0; e--)
|
|
780
|
-
this._childClusters[e]._restorePosition();
|
|
781
|
-
else
|
|
782
|
-
for (let e = this._childClusters.length - 1; e >= 0; e--)
|
|
783
|
-
this._childClusters[e]._recursivelyRestoreChildPositions(t);
|
|
784
|
-
},
|
|
785
|
-
_restorePosition: function() {
|
|
786
|
-
this._backupLatlng && (this.setLatLng(this._backupLatlng), delete this._backupLatlng);
|
|
787
|
-
},
|
|
788
|
-
//exceptBounds: If set, don't remove any markers/clusters in it
|
|
789
|
-
_recursivelyRemoveChildrenFromMap: function(t, e, i, n) {
|
|
790
|
-
var s, o;
|
|
791
|
-
this._recursively(
|
|
792
|
-
t,
|
|
793
|
-
e - 1,
|
|
794
|
-
i - 1,
|
|
795
|
-
(r) => {
|
|
796
|
-
for (o = r._markers.length - 1; o >= 0; o--)
|
|
797
|
-
s = r._markers[o], (!n || !n.contains(s._latlng)) && (r._group._featureGroup.removeLayer(s), s.clusterShow && s.clusterShow());
|
|
798
|
-
},
|
|
799
|
-
(r) => {
|
|
800
|
-
for (o = r._childClusters.length - 1; o >= 0; o--)
|
|
801
|
-
s = r._childClusters[o], (!n || !n.contains(s._latlng)) && (r._group._featureGroup.removeLayer(s), s.clusterShow && s.clusterShow());
|
|
802
|
-
}
|
|
803
|
-
);
|
|
804
|
-
},
|
|
805
|
-
//Run the given functions recursively to this and child clusters
|
|
806
|
-
// boundsToApplyTo: a L.LatLngBounds representing the bounds of what clusters to recurse in to
|
|
807
|
-
// zoomLevelToStart: zoom level to start running functions (inclusive)
|
|
808
|
-
// zoomLevelToStop: zoom level to stop running functions (inclusive)
|
|
809
|
-
// runAtEveryLevel: function that takes an L.MarkerCluster as an argument that should be applied on every level
|
|
810
|
-
// runAtBottomLevel: function that takes an L.MarkerCluster as an argument that should be applied at only the bottom level
|
|
811
|
-
_recursively: function(t, e, i, n, s) {
|
|
812
|
-
var o = this._childClusters, r = this._zoom, a, h;
|
|
813
|
-
if (e <= r && (n && n(this), s && r === i && s(this)), r < e || r < i)
|
|
814
|
-
for (a = o.length - 1; a >= 0; a--)
|
|
815
|
-
h = o[a], t.intersects(h._bounds) && h._recursively(
|
|
816
|
-
t,
|
|
817
|
-
e,
|
|
818
|
-
i,
|
|
819
|
-
n,
|
|
820
|
-
s
|
|
821
|
-
);
|
|
822
|
-
},
|
|
823
|
-
//Returns true if we are the parent of only one cluster and that cluster is the same as us
|
|
824
|
-
_isSingleParent: function() {
|
|
825
|
-
return this._childClusters.length > 0 && this._childClusters[0]._childCount === this._childCount;
|
|
826
|
-
}
|
|
827
|
-
});
|
|
828
|
-
u.Marker.include({
|
|
829
|
-
clusterHide: function() {
|
|
830
|
-
return this.options.opacityWhenUnclustered = this.options.opacity || 1, this.setOpacity(0);
|
|
831
|
-
},
|
|
832
|
-
clusterShow: function() {
|
|
833
|
-
var t = this.setOpacity(
|
|
834
|
-
this.options.opacity || this.options.opacityWhenUnclustered
|
|
835
|
-
);
|
|
836
|
-
return delete this.options.opacityWhenUnclustered, t;
|
|
837
|
-
}
|
|
838
|
-
});
|
|
839
|
-
u.DistanceGrid = function(t) {
|
|
840
|
-
this._cellSize = t, this._sqCellSize = t * t, this._grid = {}, this._objectPoint = {};
|
|
841
|
-
};
|
|
842
|
-
u.DistanceGrid.prototype = {
|
|
843
|
-
addObject: function(t, e) {
|
|
844
|
-
var i = this._getCoord(e.x), n = this._getCoord(e.y), s = this._grid;
|
|
845
|
-
s[n] = s[n] || {};
|
|
846
|
-
var o = s[n];
|
|
847
|
-
o[i] = o[i] || [];
|
|
848
|
-
var r = o[i], a = u.Util.stamp(t);
|
|
849
|
-
this._objectPoint[a] = e, r.push(t);
|
|
850
|
-
},
|
|
851
|
-
updateObject: function(t, e) {
|
|
852
|
-
this.removeObject(t), this.addObject(t, e);
|
|
853
|
-
},
|
|
854
|
-
//Returns true if the object was found
|
|
855
|
-
removeObject: function(t, e) {
|
|
856
|
-
var i = this._getCoord(e.x), n = this._getCoord(e.y), s = this._grid;
|
|
857
|
-
s[n] = s[n] || {};
|
|
858
|
-
var o = s[n];
|
|
859
|
-
o[i] = o[i] || [];
|
|
860
|
-
var r = o[i], a, h;
|
|
861
|
-
for (delete this._objectPoint[u.Util.stamp(t)], a = 0, h = r.length; a < h; a++)
|
|
862
|
-
if (r[a] === t)
|
|
863
|
-
return r.splice(a, 1), h === 1 && delete o[i], !0;
|
|
864
|
-
},
|
|
865
|
-
eachObject: function(t, e) {
|
|
866
|
-
var i, n, s, o, r, a, h, _ = this._grid;
|
|
867
|
-
for (i in _) {
|
|
868
|
-
r = _[i];
|
|
869
|
-
for (n in r)
|
|
870
|
-
for (a = r[n], s = 0, o = a.length; s < o; s++)
|
|
871
|
-
h = t.call(e, a[s]), h && (s--, o--);
|
|
872
|
-
}
|
|
873
|
-
},
|
|
874
|
-
getNearObject: function(t) {
|
|
875
|
-
var e = this._getCoord(t.x), i = this._getCoord(t.y), n, s, o, r, a, h, _, l, d = this._objectPoint, p = this._sqCellSize, f = null;
|
|
876
|
-
for (n = i - 1; n <= i + 1; n++)
|
|
877
|
-
if (r = this._grid[n], r) {
|
|
878
|
-
for (s = e - 1; s <= e + 1; s++)
|
|
879
|
-
if (a = r[s], a)
|
|
880
|
-
for (o = 0, h = a.length; o < h; o++)
|
|
881
|
-
_ = a[o], l = this._sqDist(d[u.Util.stamp(_)], t), l < p && (p = l, f = _);
|
|
882
|
-
}
|
|
883
|
-
return f;
|
|
884
|
-
},
|
|
885
|
-
_getCoord: function(t) {
|
|
886
|
-
return Math.floor(t / this._cellSize);
|
|
887
|
-
},
|
|
888
|
-
_sqDist: (t, e) => {
|
|
889
|
-
var i = e.x - t.x, n = e.y - t.y;
|
|
890
|
-
return i * i + n * n;
|
|
891
|
-
}
|
|
892
|
-
};
|
|
893
|
-
u.QuickHull = {
|
|
894
|
-
/*
|
|
895
|
-
* @param {Object} cpt a point to be measured from the baseline
|
|
896
|
-
* @param {Array} bl the baseline, as represented by a two-element
|
|
897
|
-
* array of latlng objects.
|
|
898
|
-
* @returns {Number} an approximate distance measure
|
|
899
|
-
*/
|
|
900
|
-
getDistant: (t, e) => {
|
|
901
|
-
var i = e[1].lat - e[0].lat, n = e[0].lng - e[1].lng;
|
|
902
|
-
return n * (t.lat - e[0].lat) + i * (t.lng - e[0].lng);
|
|
903
|
-
},
|
|
904
|
-
/*
|
|
905
|
-
* @param {Array} baseLine a two-element array of latlng objects
|
|
906
|
-
* representing the baseline to project from
|
|
907
|
-
* @param {Array} latLngs an array of latlng objects
|
|
908
|
-
* @returns {Object} the maximum point and all new points to stay
|
|
909
|
-
* in consideration for the hull.
|
|
910
|
-
*/
|
|
911
|
-
findMostDistantPointFromBaseLine: function(t, e) {
|
|
912
|
-
var i = 0, n = null, s = [], o, r, a;
|
|
913
|
-
for (o = e.length - 1; o >= 0; o--) {
|
|
914
|
-
if (r = e[o], a = this.getDistant(r, t), a > 0)
|
|
915
|
-
s.push(r);
|
|
916
|
-
else
|
|
917
|
-
continue;
|
|
918
|
-
a > i && (i = a, n = r);
|
|
919
|
-
}
|
|
920
|
-
return { maxPoint: n, newPoints: s };
|
|
921
|
-
},
|
|
922
|
-
/*
|
|
923
|
-
* Given a baseline, compute the convex hull of latLngs as an array
|
|
924
|
-
* of latLngs.
|
|
925
|
-
*
|
|
926
|
-
* @param {Array} latLngs
|
|
927
|
-
* @returns {Array}
|
|
928
|
-
*/
|
|
929
|
-
buildConvexHull: function(t, e) {
|
|
930
|
-
var i = [], n = this.findMostDistantPointFromBaseLine(t, e);
|
|
931
|
-
return n.maxPoint ? (i = i.concat(
|
|
932
|
-
this.buildConvexHull([t[0], n.maxPoint], n.newPoints)
|
|
933
|
-
), i = i.concat(
|
|
934
|
-
this.buildConvexHull([n.maxPoint, t[1]], n.newPoints)
|
|
935
|
-
), i) : [t[0]];
|
|
936
|
-
},
|
|
937
|
-
/*
|
|
938
|
-
* Given an array of latlngs, compute a convex hull as an array
|
|
939
|
-
* of latlngs
|
|
940
|
-
*
|
|
941
|
-
* @param {Array} latLngs
|
|
942
|
-
* @returns {Array}
|
|
943
|
-
*/
|
|
944
|
-
getConvexHull: function(t) {
|
|
945
|
-
var e = !1, i = !1, n = !1, s = !1, o = null, r = null, a = null, h = null, _ = null, l = null, d;
|
|
946
|
-
for (d = t.length - 1; d >= 0; d--) {
|
|
947
|
-
const f = t[d];
|
|
948
|
-
(e === !1 || f.lat > e) && (o = f, e = f.lat), (i === !1 || f.lat < i) && (r = f, i = f.lat), (n === !1 || f.lng > n) && (a = f, n = f.lng), (s === !1 || f.lng < s) && (h = f, s = f.lng);
|
|
949
|
-
}
|
|
950
|
-
i !== e ? (l = r, _ = o) : (l = h, _ = a);
|
|
951
|
-
var p = [].concat(
|
|
952
|
-
this.buildConvexHull([l, _], t),
|
|
953
|
-
this.buildConvexHull([_, l], t)
|
|
954
|
-
);
|
|
955
|
-
return p;
|
|
956
|
-
}
|
|
957
|
-
};
|
|
958
|
-
u.MarkerCluster.include({
|
|
959
|
-
getConvexHull: function() {
|
|
960
|
-
var t = this.getAllChildMarkers(), e = [], i, n;
|
|
961
|
-
for (n = t.length - 1; n >= 0; n--)
|
|
962
|
-
i = t[n].getLatLng(), e.push(i);
|
|
963
|
-
return u.QuickHull.getConvexHull(e);
|
|
964
|
-
}
|
|
965
|
-
});
|
|
966
|
-
u.MarkerCluster.include({
|
|
967
|
-
_2PI: Math.PI * 2,
|
|
968
|
-
_circleFootSeparation: 25,
|
|
969
|
-
//related to circumference of circle
|
|
970
|
-
_circleStartAngle: Math.PI / 6,
|
|
971
|
-
_spiralFootSeparation: 28,
|
|
972
|
-
//related to size of spiral (experiment!)
|
|
973
|
-
_spiralLengthStart: 11,
|
|
974
|
-
_spiralLengthFactor: 5,
|
|
975
|
-
_circleSpiralSwitchover: 9,
|
|
976
|
-
//show spiral instead of circle from this marker count upwards.
|
|
977
|
-
// 0 -> always spiral; Infinity -> always circle
|
|
978
|
-
spiderfy: function() {
|
|
979
|
-
if (!(this._group._spiderfied === this || this._group._inZoomAnimation)) {
|
|
980
|
-
var t = this.getAllChildMarkers(), e = this._group, i = e._map, n = i.latLngToLayerPoint(this._latlng), s;
|
|
981
|
-
this._group._unspiderfy(), this._group._spiderfied = this, t.length >= this._circleSpiralSwitchover ? s = this._generatePointsSpiral(t.length, n) : (n.y += 10, s = this._generatePointsCircle(t.length, n)), this._animationSpiderfy(t, s);
|
|
982
|
-
}
|
|
983
|
-
},
|
|
984
|
-
unspiderfy: function(t) {
|
|
985
|
-
this._group._inZoomAnimation || (this._animationUnspiderfy(t), this._group._spiderfied = null);
|
|
986
|
-
},
|
|
987
|
-
_generatePointsCircle: function(t, e) {
|
|
988
|
-
var i = this._group.options.spiderfyDistanceMultiplier * this._circleFootSeparation * (2 + t), n = i / this._2PI, s = this._2PI / t, o = [], r, a;
|
|
989
|
-
for (o.length = t, r = t - 1; r >= 0; r--)
|
|
990
|
-
a = this._circleStartAngle + r * s, o[r] = new u.Point(
|
|
991
|
-
e.x + n * Math.cos(a),
|
|
992
|
-
e.y + n * Math.sin(a)
|
|
993
|
-
)._round();
|
|
994
|
-
return o;
|
|
995
|
-
},
|
|
996
|
-
_generatePointsSpiral: function(t, e) {
|
|
997
|
-
var i = this._group.options.spiderfyDistanceMultiplier, n = i * this._spiralLengthStart, s = i * this._spiralFootSeparation, o = i * this._spiralLengthFactor * this._2PI, r = 0, a = [], h;
|
|
998
|
-
for (a.length = t, h = t - 1; h >= 0; h--)
|
|
999
|
-
r += s / n + h * 5e-4, a[h] = new u.Point(
|
|
1000
|
-
e.x + n * Math.cos(r),
|
|
1001
|
-
e.y + n * Math.sin(r)
|
|
1002
|
-
)._round(), n += o / r;
|
|
1003
|
-
return a;
|
|
1004
|
-
},
|
|
1005
|
-
_noanimationUnspiderfy: function() {
|
|
1006
|
-
var t = this._group, e = t._map, i = t._featureGroup, n = this.getAllChildMarkers(), s, o;
|
|
1007
|
-
for (t._ignoreMove = !0, this.setOpacity(1), o = n.length - 1; o >= 0; o--)
|
|
1008
|
-
s = n[o], i.removeLayer(s), s._preSpiderfyLatlng && (s.setLatLng(s._preSpiderfyLatlng), delete s._preSpiderfyLatlng), s.setZIndexOffset && s.setZIndexOffset(0), s._spiderLeg && (e.removeLayer(s._spiderLeg), delete s._spiderLeg);
|
|
1009
|
-
t.fire("unspiderfied", {
|
|
1010
|
-
cluster: this,
|
|
1011
|
-
markers: n
|
|
1012
|
-
}), t._ignoreMove = !1, t._spiderfied = null;
|
|
1013
|
-
}
|
|
1014
|
-
});
|
|
1015
|
-
u.MarkerClusterNonAnimated = u.MarkerCluster.extend({
|
|
1016
|
-
_animationSpiderfy: function(t, e) {
|
|
1017
|
-
var i = this._group, n = i._map, s = i._featureGroup, o = this._group.options.spiderLegPolylineOptions, r, a, h, _;
|
|
1018
|
-
for (i._ignoreMove = !0, r = 0; r < t.length; r++)
|
|
1019
|
-
_ = n.layerPointToLatLng(e[r]), a = t[r], h = new u.Polyline([this._latlng, _], o), n.addLayer(h), a._spiderLeg = h, a._preSpiderfyLatlng = a._latlng, a.setLatLng(_), a.setZIndexOffset && a.setZIndexOffset(1e6), s.addLayer(a);
|
|
1020
|
-
this.setOpacity(0.3), i._ignoreMove = !1, i.fire("spiderfied", {
|
|
1021
|
-
cluster: this,
|
|
1022
|
-
markers: t
|
|
1023
|
-
});
|
|
1024
|
-
},
|
|
1025
|
-
_animationUnspiderfy: function() {
|
|
1026
|
-
this._noanimationUnspiderfy();
|
|
1027
|
-
}
|
|
1028
|
-
});
|
|
1029
|
-
u.MarkerCluster.include({
|
|
1030
|
-
_animationSpiderfy: function(t, e) {
|
|
1031
|
-
var i = this._group, n = i._map, s = i._featureGroup, o = this._latlng, r = n.latLngToLayerPoint(o), a = u.Path.SVG, h = Object.assign(
|
|
1032
|
-
{},
|
|
1033
|
-
this._group.options.spiderLegPolylineOptions
|
|
1034
|
-
), _ = h.opacity, l, d, p, f, c, g;
|
|
1035
|
-
for (_ === void 0 && (_ = u.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity), a ? (h.opacity = 0, h.className = `${h.className || ""} leaflet-cluster-spider-leg`) : h.opacity = _, i._ignoreMove = !0, l = 0; l < t.length; l++)
|
|
1036
|
-
d = t[l], g = n.layerPointToLatLng(e[l]), p = new u.Polyline([o, g], h), n.addLayer(p), d._spiderLeg = p, a && (f = p._path, c = f.getTotalLength() + 0.1, f.style.strokeDasharray = c, f.style.strokeDashoffset = c), d.setZIndexOffset && d.setZIndexOffset(1e6), d.clusterHide && d.clusterHide(), s.addLayer(d), d._setPos && d._setPos(r);
|
|
1037
|
-
for (i._forceLayout(), i._animationStart(), l = t.length - 1; l >= 0; l--)
|
|
1038
|
-
g = n.layerPointToLatLng(e[l]), d = t[l], d._preSpiderfyLatlng = d._latlng, d.setLatLng(g), d.clusterShow && d.clusterShow(), a && (p = d._spiderLeg, f = p._path, f.style.strokeDashoffset = 0, p.setStyle({ opacity: _ }));
|
|
1039
|
-
this.setOpacity(0.3), i._ignoreMove = !1, setTimeout(() => {
|
|
1040
|
-
i._animationEnd(), i.fire("spiderfied", {
|
|
1041
|
-
cluster: this,
|
|
1042
|
-
markers: t
|
|
1043
|
-
});
|
|
1044
|
-
}, 200);
|
|
1045
|
-
},
|
|
1046
|
-
_animationUnspiderfy: function(t) {
|
|
1047
|
-
var e = this._group, i = e._map, n = e._featureGroup, s = t ? i._latLngToNewLayerPoint(
|
|
1048
|
-
this._latlng,
|
|
1049
|
-
t.zoom,
|
|
1050
|
-
t.center
|
|
1051
|
-
) : i.latLngToLayerPoint(this._latlng), o = this.getAllChildMarkers(), r = u.Path.SVG, a, h, _, l, d, p;
|
|
1052
|
-
for (e._ignoreMove = !0, e._animationStart(), this.setOpacity(1), h = o.length - 1; h >= 0; h--)
|
|
1053
|
-
a = o[h], a._preSpiderfyLatlng && (a.closePopup(), a.setLatLng(a._preSpiderfyLatlng), delete a._preSpiderfyLatlng, p = !0, a._setPos && (a._setPos(s), p = !1), a.clusterHide && (a.clusterHide(), p = !1), p && n.removeLayer(a), r && (_ = a._spiderLeg, l = _._path, d = l.getTotalLength() + 0.1, l.style.strokeDashoffset = d, _.setStyle({ opacity: 0 })));
|
|
1054
|
-
e._ignoreMove = !1, setTimeout(() => {
|
|
1055
|
-
var f = 0;
|
|
1056
|
-
for (h = o.length - 1; h >= 0; h--)
|
|
1057
|
-
a = o[h], a._spiderLeg && f++;
|
|
1058
|
-
for (h = o.length - 1; h >= 0; h--)
|
|
1059
|
-
a = o[h], a._spiderLeg && (a.clusterShow && a.clusterShow(), a.setZIndexOffset && a.setZIndexOffset(0), f > 1 && n.removeLayer(a), i.removeLayer(a._spiderLeg), delete a._spiderLeg);
|
|
1060
|
-
e._animationEnd(), e.fire("unspiderfied", {
|
|
1061
|
-
cluster: this,
|
|
1062
|
-
markers: o
|
|
1063
|
-
});
|
|
1064
|
-
}, 200);
|
|
1065
|
-
}
|
|
1066
|
-
});
|
|
1067
|
-
u.MarkerClusterGroup.include({
|
|
1068
|
-
//The MarkerCluster currently spiderfied (if any)
|
|
1069
|
-
_spiderfied: null,
|
|
1070
|
-
unspiderfy: function(...t) {
|
|
1071
|
-
this._unspiderfy.apply(this, t);
|
|
1072
|
-
},
|
|
1073
|
-
_spiderfierOnAdd: function() {
|
|
1074
|
-
this._map.on("click", this._unspiderfyWrapper, this), this._map.options.zoomAnimation && this._map.on("zoomstart", this._unspiderfyZoomStart, this), this._map.on("zoomend", this._noanimationUnspiderfy, this), u.Browser.touch || this._map.getRenderer(this);
|
|
1075
|
-
},
|
|
1076
|
-
_spiderfierOnRemove: function() {
|
|
1077
|
-
this._map.off("click", this._unspiderfyWrapper, this), this._map.off("zoomstart", this._unspiderfyZoomStart, this), this._map.off("zoomanim", this._unspiderfyZoomAnim, this), this._map.off("zoomend", this._noanimationUnspiderfy, this), this._noanimationUnspiderfy();
|
|
1078
|
-
},
|
|
1079
|
-
//On zoom start we add a zoomanim handler so that we are guaranteed to be last (after markers are animated)
|
|
1080
|
-
//This means we can define the animation they do rather than Markers doing an animation to their actual location
|
|
1081
|
-
_unspiderfyZoomStart: function() {
|
|
1082
|
-
this._map && this._map.on("zoomanim", this._unspiderfyZoomAnim, this);
|
|
1083
|
-
},
|
|
1084
|
-
_unspiderfyZoomAnim: function(t) {
|
|
1085
|
-
this._map._mapPane.classList.contains("leaflet-touching") || (this._map.off("zoomanim", this._unspiderfyZoomAnim, this), this._unspiderfy(t));
|
|
1086
|
-
},
|
|
1087
|
-
_unspiderfyWrapper: function() {
|
|
1088
|
-
this._unspiderfy();
|
|
1089
|
-
},
|
|
1090
|
-
_unspiderfy: function(t) {
|
|
1091
|
-
this._spiderfied && this._spiderfied.unspiderfy(t);
|
|
1092
|
-
},
|
|
1093
|
-
_noanimationUnspiderfy: function() {
|
|
1094
|
-
this._spiderfied && this._spiderfied._noanimationUnspiderfy();
|
|
1095
|
-
},
|
|
1096
|
-
//If the given layer is currently being spiderfied then we unspiderfy it so it isn't on the map anymore etc
|
|
1097
|
-
_unspiderfyLayer: function(t) {
|
|
1098
|
-
t._spiderLeg && (this._featureGroup.removeLayer(t), t.clusterShow && t.clusterShow(), t.setZIndexOffset && t.setZIndexOffset(0), this._map.removeLayer(t._spiderLeg), delete t._spiderLeg);
|
|
1099
|
-
}
|
|
1100
|
-
});
|
|
1101
|
-
u.MarkerClusterGroup.include({
|
|
1102
|
-
/**
|
|
1103
|
-
* Updates the icon of all clusters which are parents of the given marker(s).
|
|
1104
|
-
* In singleMarkerMode, also updates the given marker(s) icon.
|
|
1105
|
-
* @param layers L.MarkerClusterGroup|L.LayerGroup|Array(L.Marker)|Map(L.Marker)|
|
|
1106
|
-
* L.MarkerCluster|L.Marker (optional) list of markers (or single marker) whose parent
|
|
1107
|
-
* clusters need to be updated. If not provided, retrieves all child markers of this.
|
|
1108
|
-
* @returns {L.MarkerClusterGroup}
|
|
1109
|
-
*/
|
|
1110
|
-
refreshClusters: function(t) {
|
|
1111
|
-
return t ? t instanceof u.MarkerClusterGroup ? t = t._topClusterLevel.getAllChildMarkers() : t instanceof u.LayerGroup ? t = t._layers : t instanceof u.MarkerCluster ? t = t.getAllChildMarkers() : t instanceof u.Marker && (t = [t]) : t = this._topClusterLevel.getAllChildMarkers(), this._flagParentsIconsNeedUpdate(t), this._refreshClustersIcons(), this.options.singleMarkerMode && this._refreshSingleMarkerModeMarkers(t), this;
|
|
1112
|
-
},
|
|
1113
|
-
/**
|
|
1114
|
-
* Simply flags all parent clusters of the given markers as having a "dirty" icon.
|
|
1115
|
-
* @param layers Array(L.Marker)|Map(L.Marker) list of markers.
|
|
1116
|
-
* @private
|
|
1117
|
-
*/
|
|
1118
|
-
_flagParentsIconsNeedUpdate: (t) => {
|
|
1119
|
-
var e, i;
|
|
1120
|
-
for (e in t)
|
|
1121
|
-
for (i = t[e].__parent; i; )
|
|
1122
|
-
i._iconNeedsUpdate = !0, i = i.__parent;
|
|
1123
|
-
},
|
|
1124
|
-
/**
|
|
1125
|
-
* Re-draws the icon of the supplied markers.
|
|
1126
|
-
* To be used in singleMarkerMode only.
|
|
1127
|
-
* @param layers Array(L.Marker)|Map(L.Marker) list of markers.
|
|
1128
|
-
* @private
|
|
1129
|
-
*/
|
|
1130
|
-
_refreshSingleMarkerModeMarkers: function(t) {
|
|
1131
|
-
var e, i;
|
|
1132
|
-
for (e in t)
|
|
1133
|
-
i = t[e], this.hasLayer(i) && i.setIcon(this._overrideMarkerIcon(i));
|
|
1134
|
-
}
|
|
1135
|
-
});
|
|
1136
|
-
u.Marker.include({
|
|
1137
|
-
/**
|
|
1138
|
-
* Updates the given options in the marker's icon and refreshes the marker.
|
|
1139
|
-
* @param options map object of icon options.
|
|
1140
|
-
* @param directlyRefreshClusters boolean (optional) true to trigger
|
|
1141
|
-
* MCG.refreshClustersOf() right away with this single marker.
|
|
1142
|
-
* @returns {L.Marker}
|
|
1143
|
-
*/
|
|
1144
|
-
refreshIconOptions: function(t, e) {
|
|
1145
|
-
var i = this.options.icon;
|
|
1146
|
-
return u.setOptions(i, t), this.setIcon(i), e && this.__parent && this.__parent._group.refreshClusters(this), this;
|
|
1147
|
-
}
|
|
1148
|
-
});
|
|
1149
|
-
//# sourceMappingURL=cluster.js.map
|
|
1
|
+
import e from "../external/leaflet/dist/leaflet-src.js";
|
|
2
|
+
e.MarkerClusterGroup = e.FeatureGroup.extend({
|
|
3
|
+
options: {
|
|
4
|
+
maxClusterRadius: 80,
|
|
5
|
+
iconCreateFunction: null,
|
|
6
|
+
spiderfyOnMaxZoom: !0,
|
|
7
|
+
showCoverageOnHover: !0,
|
|
8
|
+
zoomToBoundsOnClick: !0,
|
|
9
|
+
singleMarkerMode: !1,
|
|
10
|
+
disableClusteringAtZoom: null,
|
|
11
|
+
removeOutsideVisibleBounds: !0,
|
|
12
|
+
animate: !0,
|
|
13
|
+
animateAddingMarkers: !1,
|
|
14
|
+
spiderfyDistanceMultiplier: 1,
|
|
15
|
+
spiderLegPolylineOptions: {
|
|
16
|
+
weight: 1.5,
|
|
17
|
+
color: "#222",
|
|
18
|
+
opacity: .5
|
|
19
|
+
},
|
|
20
|
+
chunkedLoading: !1,
|
|
21
|
+
chunkInterval: 200,
|
|
22
|
+
chunkDelay: 50,
|
|
23
|
+
chunkProgress: null,
|
|
24
|
+
polygonOptions: {}
|
|
25
|
+
},
|
|
26
|
+
initialize: function(t) {
|
|
27
|
+
e.Util.setOptions(this, t), this.options.iconCreateFunction || (this.options.iconCreateFunction = this._defaultIconCreateFunction), this.options.clusterPane || (this.options.clusterPane = e.Marker.prototype.options.pane), this._featureGroup = new e.FeatureGroup(), this._featureGroup.addEventParent(this), this._nonPointGroup = new e.FeatureGroup(), this._nonPointGroup.addEventParent(this), this._inZoomAnimation = 0, this._needsClustering = [], this._needsRemoving = [], this._currentShownBounds = null, this._queue = [], this._childMarkerEventHandlers = {
|
|
28
|
+
dragstart: this._childMarkerDragStart,
|
|
29
|
+
move: this._childMarkerMoved,
|
|
30
|
+
dragend: this._childMarkerDragEnd
|
|
31
|
+
};
|
|
32
|
+
var n = e.DomUtil.TRANSITION && this.options.animate;
|
|
33
|
+
Object.assign(this, n ? this._withAnimation : this._noAnimation), this._markerCluster = n ? e.MarkerCluster : e.MarkerClusterNonAnimated;
|
|
34
|
+
},
|
|
35
|
+
addLayer: function(t) {
|
|
36
|
+
if (t instanceof e.LayerGroup) return this.addLayers([t]);
|
|
37
|
+
if (!t.getLatLng) return this._nonPointGroup.addLayer(t), this.fire("layeradd", {
|
|
38
|
+
layer: t,
|
|
39
|
+
propagatedFrom: t
|
|
40
|
+
}), this;
|
|
41
|
+
if (!this._map) return this._needsClustering.push(t), this.fire("layeradd", {
|
|
42
|
+
layer: t,
|
|
43
|
+
propagatedFrom: t
|
|
44
|
+
}), this;
|
|
45
|
+
if (this.hasLayer(t)) return this;
|
|
46
|
+
this._unspiderfy && this._unspiderfy(), this._addLayer(t, this._maxZoom), this.fire("layeradd", {
|
|
47
|
+
layer: t,
|
|
48
|
+
propagatedFrom: t
|
|
49
|
+
}), this._topClusterLevel._recalculateBounds(), this._refreshClustersIcons();
|
|
50
|
+
var n = t, r = this._zoom;
|
|
51
|
+
if (t.__parent) for (; n.__parent._zoom >= r;) n = n.__parent;
|
|
52
|
+
return this._currentShownBounds.contains(n.getLatLng()) && (this.options.animateAddingMarkers ? this._animationAddLayer(t, n) : this._animationAddLayerNonAnimated(t, n)), this;
|
|
53
|
+
},
|
|
54
|
+
removeLayer: function(t) {
|
|
55
|
+
return t instanceof e.LayerGroup ? this.removeLayers([t]) : t.getLatLng ? this._map ? t.__parent ? (this._unspiderfy && (this._unspiderfy(), this._unspiderfyLayer(t)), this._removeLayer(t, !0), this.fire("layerremove", {
|
|
56
|
+
layer: t,
|
|
57
|
+
propagatedFrom: t
|
|
58
|
+
}), this._topClusterLevel._recalculateBounds(), this._refreshClustersIcons(), t.off(this._childMarkerEventHandlers, this), this._featureGroup.hasLayer(t) && (this._featureGroup.removeLayer(t), t.clusterShow && t.clusterShow()), this) : this : (!this._arraySplice(this._needsClustering, t) && this.hasLayer(t) && this._needsRemoving.push({
|
|
59
|
+
layer: t,
|
|
60
|
+
latlng: t._latlng
|
|
61
|
+
}), this.fire("layerremove", {
|
|
62
|
+
layer: t,
|
|
63
|
+
propagatedFrom: t
|
|
64
|
+
}), this) : (this._nonPointGroup.removeLayer(t), this.fire("layerremove", {
|
|
65
|
+
layer: t,
|
|
66
|
+
propagatedFrom: t
|
|
67
|
+
}), this);
|
|
68
|
+
},
|
|
69
|
+
addLayers: function(t, n) {
|
|
70
|
+
if (!Array.isArray(t)) return this.addLayer(t);
|
|
71
|
+
var r = this._featureGroup, i = this._nonPointGroup, a = this.options.chunkedLoading, o = this.options.chunkInterval, s = this.options.chunkProgress, c = t.length, l = 0, u = !0, d;
|
|
72
|
+
if (this._map) {
|
|
73
|
+
let f = Date.now(), p = () => {
|
|
74
|
+
for (var m = Date.now(); l < c && !(a && l % 200 == 0 && Date.now() - m > o); l++) {
|
|
75
|
+
if (d = t[l], d instanceof e.LayerGroup) {
|
|
76
|
+
u &&= (t = t.slice(), !1), this._extractNonGroupLayers(d, t), c = t.length;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (!d.getLatLng) {
|
|
80
|
+
i.addLayer(d), n || this.fire("layeradd", {
|
|
81
|
+
layer: d,
|
|
82
|
+
propagatedFrom: d
|
|
83
|
+
});
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (!this.hasLayer(d) && (this._addLayer(d, this._maxZoom), n || this.fire("layeradd", {
|
|
87
|
+
layer: d,
|
|
88
|
+
propagatedFrom: d
|
|
89
|
+
}), d.__parent && d.__parent.getChildCount() === 2)) {
|
|
90
|
+
let e = d.__parent.getAllChildMarkers(), t = e[0] === d ? e[1] : e[0];
|
|
91
|
+
r.removeLayer(t);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
s && s(l, c, Date.now() - f), l === c ? (this._topClusterLevel._recalculateBounds(), this._refreshClustersIcons(), this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds)) : setTimeout(p, this.options.chunkDelay);
|
|
95
|
+
};
|
|
96
|
+
p();
|
|
97
|
+
} else {
|
|
98
|
+
let n = this._needsClustering;
|
|
99
|
+
for (; l < c; l++) {
|
|
100
|
+
if (d = t[l], d instanceof e.LayerGroup) {
|
|
101
|
+
u &&= (t = t.slice(), !1), this._extractNonGroupLayers(d, t), c = t.length;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (!d.getLatLng) {
|
|
105
|
+
i.addLayer(d);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
this.hasLayer(d) || n.push(d);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return this;
|
|
112
|
+
},
|
|
113
|
+
removeLayers: function(t) {
|
|
114
|
+
var n, r, i = t.length, a = this._featureGroup, o = this._nonPointGroup, s = !0;
|
|
115
|
+
if (!this._map) {
|
|
116
|
+
for (n = 0; n < i; n++) {
|
|
117
|
+
if (r = t[n], r instanceof e.LayerGroup) {
|
|
118
|
+
s &&= (t = t.slice(), !1), this._extractNonGroupLayers(r, t), i = t.length;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
this._arraySplice(this._needsClustering, r), o.removeLayer(r), this.hasLayer(r) && this._needsRemoving.push({
|
|
122
|
+
layer: r,
|
|
123
|
+
latlng: r._latlng
|
|
124
|
+
}), this.fire("layerremove", {
|
|
125
|
+
layer: r,
|
|
126
|
+
propagatedFrom: r
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
if (this._unspiderfy) {
|
|
132
|
+
this._unspiderfy();
|
|
133
|
+
let a = t.slice(), o = i;
|
|
134
|
+
for (n = 0; n < o; n++) {
|
|
135
|
+
if (r = a[n], r instanceof e.LayerGroup) {
|
|
136
|
+
this._extractNonGroupLayers(r, a), o = a.length;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
this._unspiderfyLayer(r);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
for (n = 0; n < i; n++) {
|
|
143
|
+
if (r = t[n], r instanceof e.LayerGroup) {
|
|
144
|
+
s &&= (t = t.slice(), !1), this._extractNonGroupLayers(r, t), i = t.length;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (!r.__parent) {
|
|
148
|
+
o.removeLayer(r), this.fire("layerremove", {
|
|
149
|
+
layer: r,
|
|
150
|
+
propagatedFrom: r
|
|
151
|
+
});
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
this._removeLayer(r, !0, !0), this.fire("layerremove", {
|
|
155
|
+
layer: r,
|
|
156
|
+
propagatedFrom: r
|
|
157
|
+
}), a.hasLayer(r) && (a.removeLayer(r), r.clusterShow && r.clusterShow());
|
|
158
|
+
}
|
|
159
|
+
return this._topClusterLevel._recalculateBounds(), this._refreshClustersIcons(), this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds), this;
|
|
160
|
+
},
|
|
161
|
+
clearLayers: function() {
|
|
162
|
+
return this._map || (this._needsClustering = [], delete this._gridClusters, delete this._gridUnclustered), this._noanimationUnspiderfy && this._noanimationUnspiderfy(), this._featureGroup.clearLayers(), this._nonPointGroup.clearLayers(), this.eachLayer(function(e) {
|
|
163
|
+
e.off(this._childMarkerEventHandlers, this), delete e.__parent;
|
|
164
|
+
}, this), this._map && this._generateInitialClusters(), this;
|
|
165
|
+
},
|
|
166
|
+
getBounds: function() {
|
|
167
|
+
var t = new e.LatLngBounds();
|
|
168
|
+
this._topClusterLevel && t.extend(this._topClusterLevel._bounds);
|
|
169
|
+
for (let e = this._needsClustering.length - 1; e >= 0; e--) t.extend(this._needsClustering[e].getLatLng());
|
|
170
|
+
return t.extend(this._nonPointGroup.getBounds()), t;
|
|
171
|
+
},
|
|
172
|
+
eachLayer: function(e, t) {
|
|
173
|
+
var n = this._needsClustering.slice(), r = this._needsRemoving, i, a, o;
|
|
174
|
+
for (this._topClusterLevel && this._topClusterLevel.getAllChildMarkers(n), a = n.length - 1; a >= 0; a--) {
|
|
175
|
+
for (i = !0, o = r.length - 1; o >= 0; o--) if (r[o].layer === n[a]) {
|
|
176
|
+
i = !1;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
i && e.call(t, n[a]);
|
|
180
|
+
}
|
|
181
|
+
this._nonPointGroup.eachLayer(e, t);
|
|
182
|
+
},
|
|
183
|
+
getLayers: function() {
|
|
184
|
+
var e = [];
|
|
185
|
+
return this.eachLayer((t) => {
|
|
186
|
+
e.push(t);
|
|
187
|
+
}), e;
|
|
188
|
+
},
|
|
189
|
+
getLayer: function(t) {
|
|
190
|
+
var n = null;
|
|
191
|
+
return t = parseInt(t, 10), this.eachLayer((r) => {
|
|
192
|
+
e.stamp(r) === t && (n = r);
|
|
193
|
+
}), n;
|
|
194
|
+
},
|
|
195
|
+
hasLayer: function(e) {
|
|
196
|
+
if (!e) return !1;
|
|
197
|
+
var t, n = this._needsClustering;
|
|
198
|
+
for (t = n.length - 1; t >= 0; t--) if (n[t] === e) return !0;
|
|
199
|
+
for (n = this._needsRemoving, t = n.length - 1; t >= 0; t--) if (n[t].layer === e) return !1;
|
|
200
|
+
return !!(e.__parent && e.__parent._group === this) || this._nonPointGroup.hasLayer(e);
|
|
201
|
+
},
|
|
202
|
+
zoomToShowLayer: function(e, t) {
|
|
203
|
+
typeof t != "function" && (t = () => {});
|
|
204
|
+
var n = function() {
|
|
205
|
+
(e._icon || e.__parent._icon) && !this._inZoomAnimation && (this._map.off("moveend", n, this), this.off("animationend", n, this), e._icon ? t() : e.__parent._icon && (this.once("spiderfied", t, this), e.__parent.spiderfy()));
|
|
206
|
+
};
|
|
207
|
+
e._icon && this._map.getBounds().contains(e.getLatLng()) ? t() : e.__parent._zoom < Math.round(this._map._zoom) ? (this._map.on("moveend", n, this), this._map.panTo(e.getLatLng())) : (this._map.on("moveend", n, this), this.on("animationend", n, this), e.__parent.zoomToBounds());
|
|
208
|
+
},
|
|
209
|
+
onAdd: function(e) {
|
|
210
|
+
this._map = e;
|
|
211
|
+
var t, n, r;
|
|
212
|
+
if (!Number.isFinite(this._map.getMaxZoom())) throw "Map has no maxZoom specified";
|
|
213
|
+
for (this._featureGroup.addTo(e), this._nonPointGroup.addTo(e), this._gridClusters || this._generateInitialClusters(), this._maxLat = e.options.crs.projection.MAX_LATITUDE, t = 0, n = this._needsRemoving.length; t < n; t++) r = this._needsRemoving[t], r.newlatlng = r.layer._latlng, r.layer._latlng = r.latlng;
|
|
214
|
+
for (t = 0, n = this._needsRemoving.length; t < n; t++) r = this._needsRemoving[t], this._removeLayer(r.layer, !0), r.layer._latlng = r.newlatlng;
|
|
215
|
+
this._needsRemoving = [], this._zoom = Math.round(this._map._zoom), this._currentShownBounds = this._getExpandedVisibleBounds(), this._map.on("zoomend", this._zoomEnd, this), this._map.on("moveend", this._moveEnd, this), this._spiderfierOnAdd && this._spiderfierOnAdd(), this._bindEvents(), n = this._needsClustering, this._needsClustering = [], this.addLayers(n, !0);
|
|
216
|
+
},
|
|
217
|
+
onRemove: function(e) {
|
|
218
|
+
e.off("zoomend", this._zoomEnd, this), e.off("moveend", this._moveEnd, this), this._unbindEvents(), this._map._mapPane.className = this._map._mapPane.className.replace(" leaflet-cluster-anim", ""), this._spiderfierOnRemove && this._spiderfierOnRemove(), delete this._maxLat, this._hideCoverage(), this._featureGroup.remove(), this._nonPointGroup.remove(), this._featureGroup.clearLayers(), this._map = null;
|
|
219
|
+
},
|
|
220
|
+
getVisibleParent: (e) => {
|
|
221
|
+
for (var t = e; t && !t._icon;) t = t.__parent;
|
|
222
|
+
return t || null;
|
|
223
|
+
},
|
|
224
|
+
_arraySplice: (e, t) => {
|
|
225
|
+
for (let n = e.length - 1; n >= 0; n--) if (e[n] === t) return e.splice(n, 1), !0;
|
|
226
|
+
},
|
|
227
|
+
_removeFromGridUnclustered: function(e, t) {
|
|
228
|
+
for (var n = this._map, r = this._gridUnclustered, i = Math.floor(this._map.getMinZoom()); t >= i && r[t].removeObject(e, n.project(e.getLatLng(), t)); t--);
|
|
229
|
+
},
|
|
230
|
+
_childMarkerDragStart: (e) => {
|
|
231
|
+
e.target.__dragStart = e.target._latlng;
|
|
232
|
+
},
|
|
233
|
+
_childMarkerMoved: function(e) {
|
|
234
|
+
if (!this._ignoreMove && !e.target.__dragStart) {
|
|
235
|
+
let t = (e.target._popup || null)?.isOpen();
|
|
236
|
+
this._moveChild(e.target, e.oldLatLng, e.latlng), t && e.target.openPopup();
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
_moveChild: function(e, t, n) {
|
|
240
|
+
e._latlng = t, this.removeLayer(e), e._latlng = n, this.addLayer(e);
|
|
241
|
+
},
|
|
242
|
+
_childMarkerDragEnd: function(e) {
|
|
243
|
+
e.target.__dragStart && this._moveChild(e.target, e.target.__dragStart, e.target._latlng), delete e.target.__dragStart;
|
|
244
|
+
},
|
|
245
|
+
_removeLayer: function(e, t, n) {
|
|
246
|
+
var r = this._gridClusters, i = this._gridUnclustered, a = this._featureGroup, o = this._map, s = Math.floor(this._map.getMinZoom());
|
|
247
|
+
t && this._removeFromGridUnclustered(e, this._maxZoom);
|
|
248
|
+
var c = e.__parent, l = c._markers, u;
|
|
249
|
+
for (this._arraySplice(l, e); c && (c._childCount--, c._boundsNeedUpdate = !0, !(c._zoom < s));) t && c._childCount <= 1 ? (u = c._markers[0] === e ? c._markers[1] : c._markers[0], r[c._zoom].removeObject(c, o.project(c._cLatLng, c._zoom)), i[c._zoom].addObject(u, o.project(u.getLatLng(), c._zoom)), this._arraySplice(c.__parent._childClusters, c), c.__parent._markers.push(u), u.__parent = c.__parent, c._icon && (a.removeLayer(c), n || a.addLayer(u))) : c._iconNeedsUpdate = !0, c = c.__parent;
|
|
250
|
+
delete e.__parent;
|
|
251
|
+
},
|
|
252
|
+
_isOrIsParent: (e, t) => {
|
|
253
|
+
for (; t;) {
|
|
254
|
+
if (e === t) return !0;
|
|
255
|
+
t = t.parentNode;
|
|
256
|
+
}
|
|
257
|
+
return !1;
|
|
258
|
+
},
|
|
259
|
+
fire: function(t, n, r) {
|
|
260
|
+
if (n && n.propagatedFrom instanceof e.MarkerCluster) {
|
|
261
|
+
if (n.originalEvent && this._isOrIsParent(n.propagatedFrom._icon, n.originalEvent.relatedTarget)) return;
|
|
262
|
+
t = `cluster${t}`;
|
|
263
|
+
}
|
|
264
|
+
e.FeatureGroup.prototype.fire.call(this, t, n, r);
|
|
265
|
+
},
|
|
266
|
+
listens: function(t, n) {
|
|
267
|
+
return e.FeatureGroup.prototype.listens.call(this, t, n) || e.FeatureGroup.prototype.listens.call(this, `cluster${t}`, n);
|
|
268
|
+
},
|
|
269
|
+
_defaultIconCreateFunction: (t) => {
|
|
270
|
+
let n = t.getChildCount(), r = " marker-cluster-";
|
|
271
|
+
return n < 10 ? r += "small" : n < 100 ? r += "medium" : r += "large", new e.DivIcon({
|
|
272
|
+
html: `<div><span>${n}</span></div>`,
|
|
273
|
+
className: `marker-cluster ${r}`,
|
|
274
|
+
iconSize: new e.Point(40, 40)
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
_bindEvents: function() {
|
|
278
|
+
var e = this._map, t = this.options.spiderfyOnMaxZoom, n = this.options.showCoverageOnHover, r = this.options.zoomToBoundsOnClick;
|
|
279
|
+
(t || r) && this.on("clusterclick", this._zoomOrSpiderfy, this), n && (this.on("clustermouseover", this._showCoverage, this), this.on("clustermouseout", this._hideCoverage, this), e.on("zoomend", this._hideCoverage, this));
|
|
280
|
+
},
|
|
281
|
+
_zoomOrSpiderfy: function(e) {
|
|
282
|
+
let t = e.propagatedFrom, n = t;
|
|
283
|
+
for (; n._childClusters.length === 1;) n = n._childClusters[0];
|
|
284
|
+
n._zoom === this._maxZoom && n._childCount === t._childCount && this.options.spiderfyOnMaxZoom ? t.spiderfy() : this.options.zoomToBoundsOnClick && t.zoomToBounds(), e.originalEvent && e.originalEvent.keyCode === 13 && this._map._container.focus();
|
|
285
|
+
},
|
|
286
|
+
_showCoverage: function(t) {
|
|
287
|
+
var n = this._map;
|
|
288
|
+
this._inZoomAnimation || (this._shownPolygon && n.removeLayer(this._shownPolygon), t.propagatedFrom.getChildCount() > 2 && t.propagatedFrom !== this._spiderfied && (this._shownPolygon = new e.Polygon(t.propagatedFrom.getConvexHull(), this.options.polygonOptions), n.addLayer(this._shownPolygon)));
|
|
289
|
+
},
|
|
290
|
+
_hideCoverage: function() {
|
|
291
|
+
this._shownPolygon &&= (this._map.removeLayer(this._shownPolygon), null);
|
|
292
|
+
},
|
|
293
|
+
_unbindEvents: function() {
|
|
294
|
+
var e = this.options.spiderfyOnMaxZoom, t = this.options.showCoverageOnHover, n = this.options.zoomToBoundsOnClick, r = this._map;
|
|
295
|
+
(e || n) && this.off("clusterclick", this._zoomOrSpiderfy, this), t && (this.off("clustermouseover", this._showCoverage, this), this.off("clustermouseout", this._hideCoverage, this), r.off("zoomend", this._hideCoverage, this));
|
|
296
|
+
},
|
|
297
|
+
_zoomEnd: function() {
|
|
298
|
+
this._map && (this._mergeSplitClusters(), this._zoom = Math.round(this._map._zoom), this._currentShownBounds = this._getExpandedVisibleBounds());
|
|
299
|
+
},
|
|
300
|
+
_moveEnd: function() {
|
|
301
|
+
if (!this._inZoomAnimation) {
|
|
302
|
+
var e = this._getExpandedVisibleBounds();
|
|
303
|
+
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, e), this._topClusterLevel._recursivelyAddChildrenToMap(null, Math.round(this._map._zoom), e), this._currentShownBounds = e;
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
_generateInitialClusters: function() {
|
|
307
|
+
var t = Math.ceil(this._map.getMaxZoom()), n = Math.floor(this._map.getMinZoom()), r = this.options.maxClusterRadius, i = r;
|
|
308
|
+
typeof r != "function" && (i = () => r), this.options.disableClusteringAtZoom !== null && (t = this.options.disableClusteringAtZoom - 1), this._maxZoom = t, this._gridClusters = {}, this._gridUnclustered = {};
|
|
309
|
+
for (let r = t; r >= n; r--) this._gridClusters[r] = new e.DistanceGrid(i(r)), this._gridUnclustered[r] = new e.DistanceGrid(i(r));
|
|
310
|
+
this._topClusterLevel = new this._markerCluster(this, n - 1);
|
|
311
|
+
},
|
|
312
|
+
_addLayer: function(e, t) {
|
|
313
|
+
var n = this._gridClusters, r = this._gridUnclustered, i = Math.floor(this._map.getMinZoom()), a, o;
|
|
314
|
+
for (this.options.singleMarkerMode && this._overrideMarkerIcon(e), e.on(this._childMarkerEventHandlers, this); t >= i; t--) {
|
|
315
|
+
a = this._map.project(e.getLatLng(), t);
|
|
316
|
+
let i = n[t].getNearObject(a);
|
|
317
|
+
if (i) {
|
|
318
|
+
i._addChild(e), e.__parent = i;
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (i = r[t].getNearObject(a), i) {
|
|
322
|
+
let r = i.__parent;
|
|
323
|
+
r && this._removeLayer(i, !1);
|
|
324
|
+
let a = new this._markerCluster(this, t, i, e);
|
|
325
|
+
n[t].addObject(a, this._map.project(a._cLatLng, t)), i.__parent = a, e.__parent = a;
|
|
326
|
+
let s = a;
|
|
327
|
+
for (o = t - 1; o > r._zoom; o--) s = new this._markerCluster(this, o, s), n[o].addObject(s, this._map.project(i.getLatLng(), o));
|
|
328
|
+
r._addChild(s), this._removeFromGridUnclustered(i, t);
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
r[t].addObject(e, a);
|
|
332
|
+
}
|
|
333
|
+
this._topClusterLevel._addChild(e), e.__parent = this._topClusterLevel;
|
|
334
|
+
},
|
|
335
|
+
_refreshClustersIcons: function() {
|
|
336
|
+
this._featureGroup.eachLayer((t) => {
|
|
337
|
+
t instanceof e.MarkerCluster && t._iconNeedsUpdate && t._updateIcon();
|
|
338
|
+
});
|
|
339
|
+
},
|
|
340
|
+
_enqueue: function(e) {
|
|
341
|
+
this._queue.push(e), this._queueTimeout ||= setTimeout(() => this._processQueue(), 300);
|
|
342
|
+
},
|
|
343
|
+
_processQueue: function() {
|
|
344
|
+
for (let e = 0; e < this._queue.length; e++) this._queue[e].call(this);
|
|
345
|
+
this._queue.length = 0, clearTimeout(this._queueTimeout), this._queueTimeout = null;
|
|
346
|
+
},
|
|
347
|
+
_mergeSplitClusters: function() {
|
|
348
|
+
var e = Math.round(this._map._zoom);
|
|
349
|
+
this._processQueue(), this._zoom < e && this._currentShownBounds.intersects(this._getExpandedVisibleBounds()) ? (this._animationStart(), this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, this._getExpandedVisibleBounds()), this._animationZoomIn(this._zoom, e)) : this._zoom > e ? (this._animationStart(), this._animationZoomOut(this._zoom, e)) : this._moveEnd();
|
|
350
|
+
},
|
|
351
|
+
_getExpandedVisibleBounds: function() {
|
|
352
|
+
return this.options.removeOutsideVisibleBounds ? e.Browser.mobile ? this._checkBoundsMaxLat(this._map.getBounds()) : this._checkBoundsMaxLat(this._map.getBounds().pad(1)) : this._mapBoundsInfinite;
|
|
353
|
+
},
|
|
354
|
+
_checkBoundsMaxLat: function(e) {
|
|
355
|
+
var t = this._maxLat;
|
|
356
|
+
return t !== void 0 && (e.getNorth() >= t && (e._northEast.lat = Infinity), e.getSouth() <= -t && (e._southWest.lat = -Infinity)), e;
|
|
357
|
+
},
|
|
358
|
+
_animationAddLayerNonAnimated: function(e, t) {
|
|
359
|
+
if (t === e) this._featureGroup.addLayer(e);
|
|
360
|
+
else if (t._childCount === 2) {
|
|
361
|
+
t._addToMap();
|
|
362
|
+
let e = t.getAllChildMarkers();
|
|
363
|
+
this._featureGroup.removeLayer(e[0]), this._featureGroup.removeLayer(e[1]);
|
|
364
|
+
} else t._updateIcon();
|
|
365
|
+
},
|
|
366
|
+
_extractNonGroupLayers: function(t, n) {
|
|
367
|
+
var r = t.getLayers(), i = 0, a;
|
|
368
|
+
for (n ||= []; i < r.length; i++) {
|
|
369
|
+
if (a = r[i], a instanceof e.LayerGroup) {
|
|
370
|
+
this._extractNonGroupLayers(a, n);
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
n.push(a);
|
|
374
|
+
}
|
|
375
|
+
return n;
|
|
376
|
+
},
|
|
377
|
+
_overrideMarkerIcon: function(e) {
|
|
378
|
+
return e.options.icon = this.options.iconCreateFunction({
|
|
379
|
+
getChildCount: () => 1,
|
|
380
|
+
getAllChildMarkers: () => [e]
|
|
381
|
+
}), e.options.icon;
|
|
382
|
+
}
|
|
383
|
+
}), e.MarkerClusterGroup.include({ _mapBoundsInfinite: new e.LatLngBounds(new e.LatLng(-Infinity, -Infinity), new e.LatLng(Infinity, Infinity)) }), e.MarkerClusterGroup.include({
|
|
384
|
+
_noAnimation: {
|
|
385
|
+
_animationStart: () => {},
|
|
386
|
+
_animationZoomIn: function(e, t) {
|
|
387
|
+
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), e), this._topClusterLevel._recursivelyAddChildrenToMap(null, t, this._getExpandedVisibleBounds()), this.fire("animationend");
|
|
388
|
+
},
|
|
389
|
+
_animationZoomOut: function(e, t) {
|
|
390
|
+
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), e), this._topClusterLevel._recursivelyAddChildrenToMap(null, t, this._getExpandedVisibleBounds()), this.fire("animationend");
|
|
391
|
+
},
|
|
392
|
+
_animationAddLayer: function(e, t) {
|
|
393
|
+
this._animationAddLayerNonAnimated(e, t);
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
_withAnimation: {
|
|
397
|
+
_animationStart: function() {
|
|
398
|
+
this._map._mapPane.className += " leaflet-cluster-anim", this._inZoomAnimation++;
|
|
399
|
+
},
|
|
400
|
+
_animationZoomIn: function(t, n) {
|
|
401
|
+
var r = this._getExpandedVisibleBounds(), i = this._featureGroup, a = Math.floor(this._map.getMinZoom()), o;
|
|
402
|
+
this._ignoreMove = !0, this._topClusterLevel._recursively(r, t, a, (e) => {
|
|
403
|
+
var a = e._latlng, s = e._markers, c;
|
|
404
|
+
for (r.contains(a) || (a = null), e._isSingleParent() && t + 1 === n ? (i.removeLayer(e), e._recursivelyAddChildrenToMap(null, n, r)) : (e.clusterHide(), e._recursivelyAddChildrenToMap(a, n, r)), o = s.length - 1; o >= 0; o--) c = s[o], r.contains(c._latlng) || i.removeLayer(c);
|
|
405
|
+
}), this._forceLayout(), this._topClusterLevel._recursivelyBecomeVisible(r, n), i.eachLayer((t) => {
|
|
406
|
+
!(t instanceof e.MarkerCluster) && t._icon && t.clusterShow();
|
|
407
|
+
}), this._topClusterLevel._recursively(r, t, n, (e) => {
|
|
408
|
+
e._recursivelyRestoreChildPositions(n);
|
|
409
|
+
}), this._ignoreMove = !1, this._enqueue(function() {
|
|
410
|
+
this._topClusterLevel._recursively(r, t, a, (e) => {
|
|
411
|
+
i.removeLayer(e), e.clusterShow();
|
|
412
|
+
}), this._animationEnd();
|
|
413
|
+
});
|
|
414
|
+
},
|
|
415
|
+
_animationZoomOut: function(e, t) {
|
|
416
|
+
this._animationZoomOutSingle(this._topClusterLevel, e - 1, t), this._topClusterLevel._recursivelyAddChildrenToMap(null, t, this._getExpandedVisibleBounds()), this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), e, this._getExpandedVisibleBounds());
|
|
417
|
+
},
|
|
418
|
+
_animationAddLayer: function(e, t) {
|
|
419
|
+
var n = this._featureGroup;
|
|
420
|
+
n.addLayer(e), t !== e && (t._childCount > 2 ? (t._updateIcon(), this._forceLayout(), this._animationStart(), e._setPos(this._map.latLngToLayerPoint(t.getLatLng())), e.clusterHide(), this._enqueue(() => {
|
|
421
|
+
n.removeLayer(e), e.clusterShow(), this._animationEnd();
|
|
422
|
+
})) : (this._forceLayout(), this._animationStart(), this._animationZoomOutSingle(t, this._map.getMaxZoom(), this._zoom)));
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
_animationZoomOutSingle: function(e, t, n) {
|
|
426
|
+
var r = this._getExpandedVisibleBounds(), i = Math.floor(this._map.getMinZoom());
|
|
427
|
+
e._recursivelyAnimateChildrenInAndAddSelfToMap(r, i, t + 1, n);
|
|
428
|
+
var a = this;
|
|
429
|
+
this._forceLayout(), e._recursivelyBecomeVisible(r, n), this._enqueue(function() {
|
|
430
|
+
if (e._childCount === 1) {
|
|
431
|
+
let t = e._markers[0];
|
|
432
|
+
this._ignoreMove = !0, t.setLatLng(t.getLatLng()), this._ignoreMove = !1, t.clusterShow && t.clusterShow();
|
|
433
|
+
} else e._recursively(r, n, i, (e) => {
|
|
434
|
+
e._recursivelyRemoveChildrenFromMap(r, i, t + 1);
|
|
435
|
+
});
|
|
436
|
+
a._animationEnd();
|
|
437
|
+
});
|
|
438
|
+
},
|
|
439
|
+
_animationEnd: function() {
|
|
440
|
+
this._map && (this._map._mapPane.className = this._map._mapPane.className.replace(" leaflet-cluster-anim", "")), this._inZoomAnimation--, this.fire("animationend");
|
|
441
|
+
},
|
|
442
|
+
_forceLayout: () => {
|
|
443
|
+
e.Util.falseFn(document.body.offsetWidth);
|
|
444
|
+
}
|
|
445
|
+
}), e.MarkerCluster = e.Marker.extend({
|
|
446
|
+
initialize: function(t, n, r, i) {
|
|
447
|
+
e.Marker.prototype.initialize.call(this, r ? r._cLatLng || r.getLatLng() : new e.LatLng(0, 0), {
|
|
448
|
+
icon: this,
|
|
449
|
+
pane: t.options.clusterPane
|
|
450
|
+
}), this._group = t, this._zoom = n, this._markers = [], this._childClusters = [], this._childCount = 0, this._iconNeedsUpdate = !0, this._boundsNeedUpdate = !0, this._bounds = new e.LatLngBounds(), r && this._addChild(r), i && this._addChild(i);
|
|
451
|
+
},
|
|
452
|
+
getAllChildMarkers: function(e) {
|
|
453
|
+
e ||= [];
|
|
454
|
+
for (let t = this._childClusters.length - 1; t >= 0; t--) this._childClusters[t].getAllChildMarkers(e);
|
|
455
|
+
for (let t = this._markers.length - 1; t >= 0; t--) e.push(this._markers[t]);
|
|
456
|
+
return e;
|
|
457
|
+
},
|
|
458
|
+
getChildCount: function() {
|
|
459
|
+
return this._childCount;
|
|
460
|
+
},
|
|
461
|
+
zoomToBounds: function(e) {
|
|
462
|
+
for (var t = this._childClusters.slice(), n = this._group._map, r = n.getBoundsZoom(this._bounds), i = this._zoom + 1, a = n.getZoom(), o; t.length > 0 && r > i;) {
|
|
463
|
+
i++;
|
|
464
|
+
let e = [];
|
|
465
|
+
for (o = 0; o < t.length; o++) e = e.concat(t[o]._childClusters);
|
|
466
|
+
t = e;
|
|
467
|
+
}
|
|
468
|
+
r > i ? this._group._map.setView(this._latlng, i) : r <= a ? this._group._map.setView(this._latlng, a + 1) : this._group._map.fitBounds(this._bounds, e);
|
|
469
|
+
},
|
|
470
|
+
getBounds: function() {
|
|
471
|
+
var t = new e.LatLngBounds();
|
|
472
|
+
return t.extend(this._bounds), t;
|
|
473
|
+
},
|
|
474
|
+
_updateIcon: function() {
|
|
475
|
+
this._iconNeedsUpdate = !0, this._icon && this.setIcon(this);
|
|
476
|
+
},
|
|
477
|
+
createIcon: function() {
|
|
478
|
+
return this._iconNeedsUpdate &&= (this._iconObj = this._group.options.iconCreateFunction(this), !1), this._iconObj.createIcon();
|
|
479
|
+
},
|
|
480
|
+
createShadow: function() {
|
|
481
|
+
return this._iconObj.createShadow();
|
|
482
|
+
},
|
|
483
|
+
_addChild: function(t, n) {
|
|
484
|
+
this._iconNeedsUpdate = !0, this._boundsNeedUpdate = !0, this._setClusterCenter(t), t instanceof e.MarkerCluster ? (n || (this._childClusters.push(t), t.__parent = this), this._childCount += t._childCount) : (n || this._markers.push(t), this._childCount++), this.__parent && this.__parent._addChild(t, !0);
|
|
485
|
+
},
|
|
486
|
+
_setClusterCenter: function(e) {
|
|
487
|
+
this._cLatLng ||= e._cLatLng || e._latlng;
|
|
488
|
+
},
|
|
489
|
+
_resetBounds: function() {
|
|
490
|
+
var e = this._bounds;
|
|
491
|
+
e._southWest && (e._southWest.lat = Infinity, e._southWest.lng = Infinity), e._northEast && (e._northEast.lat = -Infinity, e._northEast.lng = -Infinity);
|
|
492
|
+
},
|
|
493
|
+
_recalculateBounds: function() {
|
|
494
|
+
var t = this._markers, n = this._childClusters, r = 0, i = 0, a = this._childCount, o, s, c, l;
|
|
495
|
+
if (a !== 0) {
|
|
496
|
+
for (this._resetBounds(), o = 0; o < t.length; o++) c = t[o]._latlng, this._bounds.extend(c), r += c.lat, i += c.lng;
|
|
497
|
+
for (o = 0; o < n.length; o++) s = n[o], s._boundsNeedUpdate && s._recalculateBounds(), this._bounds.extend(s._bounds), c = s._wLatLng, l = s._childCount, r += c.lat * l, i += c.lng * l;
|
|
498
|
+
this._latlng = this._wLatLng = new e.LatLng(r / a, i / a), this._boundsNeedUpdate = !1;
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
_addToMap: function(e) {
|
|
502
|
+
e && (this._backupLatlng = this._latlng, this.setLatLng(e)), this._group._featureGroup.addLayer(this);
|
|
503
|
+
},
|
|
504
|
+
_recursivelyAnimateChildrenIn: function(e, t, n) {
|
|
505
|
+
this._recursively(e, this._group._map.getMinZoom(), n - 1, (e) => {
|
|
506
|
+
var n = e._markers, r, i;
|
|
507
|
+
for (r = n.length - 1; r >= 0; r--) i = n[r], i._icon && (i._setPos(t), i.clusterHide());
|
|
508
|
+
}, (e) => {
|
|
509
|
+
var n = e._childClusters, r, i;
|
|
510
|
+
for (r = n.length - 1; r >= 0; r--) i = n[r], i._icon && (i._setPos(t), i.clusterHide());
|
|
511
|
+
});
|
|
512
|
+
},
|
|
513
|
+
_recursivelyAnimateChildrenInAndAddSelfToMap: function(e, t, n, r) {
|
|
514
|
+
this._recursively(e, r, t, (i) => {
|
|
515
|
+
i._recursivelyAnimateChildrenIn(e, i._group._map.latLngToLayerPoint(i.getLatLng()).round(), n), i._isSingleParent() && n - 1 === r ? (i.clusterShow(), i._recursivelyRemoveChildrenFromMap(e, t, n)) : i.clusterHide(), i._addToMap();
|
|
516
|
+
});
|
|
517
|
+
},
|
|
518
|
+
_recursivelyBecomeVisible: function(e, t) {
|
|
519
|
+
this._recursively(e, this._group._map.getMinZoom(), t, null, (e) => {
|
|
520
|
+
e.clusterShow();
|
|
521
|
+
});
|
|
522
|
+
},
|
|
523
|
+
_recursivelyAddChildrenToMap: function(e, t, n) {
|
|
524
|
+
this._recursively(n, this._group._map.getMinZoom() - 1, t, (r) => {
|
|
525
|
+
if (t !== r._zoom) for (let t = r._markers.length - 1; t >= 0; t--) {
|
|
526
|
+
let i = r._markers[t];
|
|
527
|
+
n.contains(i._latlng) && (e && (i._backupLatlng = i.getLatLng(), i.setLatLng(e), i.clusterHide && i.clusterHide()), r._group._featureGroup.addLayer(i));
|
|
528
|
+
}
|
|
529
|
+
}, (t) => {
|
|
530
|
+
t._addToMap(e);
|
|
531
|
+
});
|
|
532
|
+
},
|
|
533
|
+
_recursivelyRestoreChildPositions: function(e) {
|
|
534
|
+
for (let e = this._markers.length - 1; e >= 0; e--) {
|
|
535
|
+
let t = this._markers[e];
|
|
536
|
+
t._backupLatlng && (t.setLatLng(t._backupLatlng), delete t._backupLatlng);
|
|
537
|
+
}
|
|
538
|
+
if (e - 1 === this._zoom) for (let e = this._childClusters.length - 1; e >= 0; e--) this._childClusters[e]._restorePosition();
|
|
539
|
+
else for (let t = this._childClusters.length - 1; t >= 0; t--) this._childClusters[t]._recursivelyRestoreChildPositions(e);
|
|
540
|
+
},
|
|
541
|
+
_restorePosition: function() {
|
|
542
|
+
this._backupLatlng && (this.setLatLng(this._backupLatlng), delete this._backupLatlng);
|
|
543
|
+
},
|
|
544
|
+
_recursivelyRemoveChildrenFromMap: function(e, t, n, r) {
|
|
545
|
+
var i, a;
|
|
546
|
+
this._recursively(e, t - 1, n - 1, (e) => {
|
|
547
|
+
for (a = e._markers.length - 1; a >= 0; a--) i = e._markers[a], (!r || !r.contains(i._latlng)) && (e._group._featureGroup.removeLayer(i), i.clusterShow && i.clusterShow());
|
|
548
|
+
}, (e) => {
|
|
549
|
+
for (a = e._childClusters.length - 1; a >= 0; a--) i = e._childClusters[a], (!r || !r.contains(i._latlng)) && (e._group._featureGroup.removeLayer(i), i.clusterShow && i.clusterShow());
|
|
550
|
+
});
|
|
551
|
+
},
|
|
552
|
+
_recursively: function(e, t, n, r, i) {
|
|
553
|
+
var a = this._childClusters, o = this._zoom, s, c;
|
|
554
|
+
if (t <= o && (r && r(this), i && o === n && i(this)), o < t || o < n) for (s = a.length - 1; s >= 0; s--) c = a[s], e.intersects(c._bounds) && c._recursively(e, t, n, r, i);
|
|
555
|
+
},
|
|
556
|
+
_isSingleParent: function() {
|
|
557
|
+
return this._childClusters.length > 0 && this._childClusters[0]._childCount === this._childCount;
|
|
558
|
+
}
|
|
559
|
+
}), e.Marker.include({
|
|
560
|
+
clusterHide: function() {
|
|
561
|
+
return this.options.opacityWhenUnclustered = this.options.opacity || 1, this.setOpacity(0);
|
|
562
|
+
},
|
|
563
|
+
clusterShow: function() {
|
|
564
|
+
var e = this.setOpacity(this.options.opacity || this.options.opacityWhenUnclustered);
|
|
565
|
+
return delete this.options.opacityWhenUnclustered, e;
|
|
566
|
+
}
|
|
567
|
+
}), e.DistanceGrid = function(e) {
|
|
568
|
+
this._cellSize = e, this._sqCellSize = e * e, this._grid = {}, this._objectPoint = {};
|
|
569
|
+
}, e.DistanceGrid.prototype = {
|
|
570
|
+
addObject: function(t, n) {
|
|
571
|
+
var r = this._getCoord(n.x), i = this._getCoord(n.y), a = this._grid;
|
|
572
|
+
a[i] = a[i] || {};
|
|
573
|
+
var o = a[i];
|
|
574
|
+
o[r] = o[r] || [];
|
|
575
|
+
var s = o[r], c = e.Util.stamp(t);
|
|
576
|
+
this._objectPoint[c] = n, s.push(t);
|
|
577
|
+
},
|
|
578
|
+
updateObject: function(e, t) {
|
|
579
|
+
this.removeObject(e), this.addObject(e, t);
|
|
580
|
+
},
|
|
581
|
+
removeObject: function(t, n) {
|
|
582
|
+
var r = this._getCoord(n.x), i = this._getCoord(n.y), a = this._grid;
|
|
583
|
+
a[i] = a[i] || {};
|
|
584
|
+
var o = a[i];
|
|
585
|
+
o[r] = o[r] || [];
|
|
586
|
+
var s = o[r], c, l;
|
|
587
|
+
for (delete this._objectPoint[e.Util.stamp(t)], c = 0, l = s.length; c < l; c++) if (s[c] === t) return s.splice(c, 1), l === 1 && delete o[r], !0;
|
|
588
|
+
},
|
|
589
|
+
eachObject: function(e, t) {
|
|
590
|
+
var n, r, i, a, o, s, c, l = this._grid;
|
|
591
|
+
for (n in l) for (r in o = l[n], o) for (s = o[r], i = 0, a = s.length; i < a; i++) c = e.call(t, s[i]), c && (i--, a--);
|
|
592
|
+
},
|
|
593
|
+
getNearObject: function(t) {
|
|
594
|
+
var n = this._getCoord(t.x), r = this._getCoord(t.y), i, a, o, s, c, l, u, d, f = this._objectPoint, p = this._sqCellSize, m = null;
|
|
595
|
+
for (i = r - 1; i <= r + 1; i++) if (s = this._grid[i], s) {
|
|
596
|
+
for (a = n - 1; a <= n + 1; a++) if (c = s[a], c) for (o = 0, l = c.length; o < l; o++) u = c[o], d = this._sqDist(f[e.Util.stamp(u)], t), d < p && (p = d, m = u);
|
|
597
|
+
}
|
|
598
|
+
return m;
|
|
599
|
+
},
|
|
600
|
+
_getCoord: function(e) {
|
|
601
|
+
return Math.floor(e / this._cellSize);
|
|
602
|
+
},
|
|
603
|
+
_sqDist: (e, t) => {
|
|
604
|
+
var n = t.x - e.x, r = t.y - e.y;
|
|
605
|
+
return n * n + r * r;
|
|
606
|
+
}
|
|
607
|
+
}, e.QuickHull = {
|
|
608
|
+
getDistant: (e, t) => {
|
|
609
|
+
var n = t[1].lat - t[0].lat;
|
|
610
|
+
return (t[0].lng - t[1].lng) * (e.lat - t[0].lat) + n * (e.lng - t[0].lng);
|
|
611
|
+
},
|
|
612
|
+
findMostDistantPointFromBaseLine: function(e, t) {
|
|
613
|
+
var n = 0, r = null, i = [], a, o, s;
|
|
614
|
+
for (a = t.length - 1; a >= 0; a--) {
|
|
615
|
+
if (o = t[a], s = this.getDistant(o, e), s > 0) i.push(o);
|
|
616
|
+
else continue;
|
|
617
|
+
s > n && (n = s, r = o);
|
|
618
|
+
}
|
|
619
|
+
return {
|
|
620
|
+
maxPoint: r,
|
|
621
|
+
newPoints: i
|
|
622
|
+
};
|
|
623
|
+
},
|
|
624
|
+
buildConvexHull: function(e, t) {
|
|
625
|
+
var n = [], r = this.findMostDistantPointFromBaseLine(e, t);
|
|
626
|
+
return r.maxPoint ? (n = n.concat(this.buildConvexHull([e[0], r.maxPoint], r.newPoints)), n = n.concat(this.buildConvexHull([r.maxPoint, e[1]], r.newPoints)), n) : [e[0]];
|
|
627
|
+
},
|
|
628
|
+
getConvexHull: function(e) {
|
|
629
|
+
var t = !1, n = !1, r = !1, i = !1, a = null, o = null, s = null, c = null, l = null, u = null, d;
|
|
630
|
+
for (d = e.length - 1; d >= 0; d--) {
|
|
631
|
+
let l = e[d];
|
|
632
|
+
(t === !1 || l.lat > t) && (a = l, t = l.lat), (n === !1 || l.lat < n) && (o = l, n = l.lat), (r === !1 || l.lng > r) && (s = l, r = l.lng), (i === !1 || l.lng < i) && (c = l, i = l.lng);
|
|
633
|
+
}
|
|
634
|
+
return n === t ? (u = c, l = s) : (u = o, l = a), [].concat(this.buildConvexHull([u, l], e), this.buildConvexHull([l, u], e));
|
|
635
|
+
}
|
|
636
|
+
}, e.MarkerCluster.include({ getConvexHull: function() {
|
|
637
|
+
var t = this.getAllChildMarkers(), n = [], r, i;
|
|
638
|
+
for (i = t.length - 1; i >= 0; i--) r = t[i].getLatLng(), n.push(r);
|
|
639
|
+
return e.QuickHull.getConvexHull(n);
|
|
640
|
+
} }), e.MarkerCluster.include({
|
|
641
|
+
_2PI: Math.PI * 2,
|
|
642
|
+
_circleFootSeparation: 25,
|
|
643
|
+
_circleStartAngle: Math.PI / 6,
|
|
644
|
+
_spiralFootSeparation: 28,
|
|
645
|
+
_spiralLengthStart: 11,
|
|
646
|
+
_spiralLengthFactor: 5,
|
|
647
|
+
_circleSpiralSwitchover: 9,
|
|
648
|
+
spiderfy: function() {
|
|
649
|
+
if (!(this._group._spiderfied === this || this._group._inZoomAnimation)) {
|
|
650
|
+
var e = this.getAllChildMarkers(), t = this._group._map.latLngToLayerPoint(this._latlng), n;
|
|
651
|
+
this._group._unspiderfy(), this._group._spiderfied = this, e.length >= this._circleSpiralSwitchover ? n = this._generatePointsSpiral(e.length, t) : (t.y += 10, n = this._generatePointsCircle(e.length, t)), this._animationSpiderfy(e, n);
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
unspiderfy: function(e) {
|
|
655
|
+
this._group._inZoomAnimation || (this._animationUnspiderfy(e), this._group._spiderfied = null);
|
|
656
|
+
},
|
|
657
|
+
_generatePointsCircle: function(t, n) {
|
|
658
|
+
var r = this._group.options.spiderfyDistanceMultiplier * this._circleFootSeparation * (2 + t) / this._2PI, i = this._2PI / t, a = [], o, s;
|
|
659
|
+
for (a.length = t, o = t - 1; o >= 0; o--) s = this._circleStartAngle + o * i, a[o] = new e.Point(n.x + r * Math.cos(s), n.y + r * Math.sin(s))._round();
|
|
660
|
+
return a;
|
|
661
|
+
},
|
|
662
|
+
_generatePointsSpiral: function(t, n) {
|
|
663
|
+
var r = this._group.options.spiderfyDistanceMultiplier, i = r * this._spiralLengthStart, a = r * this._spiralFootSeparation, o = r * this._spiralLengthFactor * this._2PI, s = 0, c = [], l;
|
|
664
|
+
for (c.length = t, l = t - 1; l >= 0; l--) s += a / i + l * 5e-4, c[l] = new e.Point(n.x + i * Math.cos(s), n.y + i * Math.sin(s))._round(), i += o / s;
|
|
665
|
+
return c;
|
|
666
|
+
},
|
|
667
|
+
_noanimationUnspiderfy: function() {
|
|
668
|
+
var e = this._group, t = e._map, n = e._featureGroup, r = this.getAllChildMarkers(), i, a;
|
|
669
|
+
for (e._ignoreMove = !0, this.setOpacity(1), a = r.length - 1; a >= 0; a--) i = r[a], n.removeLayer(i), i._preSpiderfyLatlng && (i.setLatLng(i._preSpiderfyLatlng), delete i._preSpiderfyLatlng), i.setZIndexOffset && i.setZIndexOffset(0), i._spiderLeg && (t.removeLayer(i._spiderLeg), delete i._spiderLeg);
|
|
670
|
+
e.fire("unspiderfied", {
|
|
671
|
+
cluster: this,
|
|
672
|
+
markers: r
|
|
673
|
+
}), e._ignoreMove = !1, e._spiderfied = null;
|
|
674
|
+
}
|
|
675
|
+
}), e.MarkerClusterNonAnimated = e.MarkerCluster.extend({
|
|
676
|
+
_animationSpiderfy: function(t, n) {
|
|
677
|
+
var r = this._group, i = r._map, a = r._featureGroup, o = this._group.options.spiderLegPolylineOptions, s, c, l, u;
|
|
678
|
+
for (r._ignoreMove = !0, s = 0; s < t.length; s++) u = i.layerPointToLatLng(n[s]), c = t[s], l = new e.Polyline([this._latlng, u], o), i.addLayer(l), c._spiderLeg = l, c._preSpiderfyLatlng = c._latlng, c.setLatLng(u), c.setZIndexOffset && c.setZIndexOffset(1e6), a.addLayer(c);
|
|
679
|
+
this.setOpacity(.3), r._ignoreMove = !1, r.fire("spiderfied", {
|
|
680
|
+
cluster: this,
|
|
681
|
+
markers: t
|
|
682
|
+
});
|
|
683
|
+
},
|
|
684
|
+
_animationUnspiderfy: function() {
|
|
685
|
+
this._noanimationUnspiderfy();
|
|
686
|
+
}
|
|
687
|
+
}), e.MarkerCluster.include({
|
|
688
|
+
_animationSpiderfy: function(t, n) {
|
|
689
|
+
var r = this._group, i = r._map, a = r._featureGroup, o = this._latlng, s = i.latLngToLayerPoint(o), c = e.Path.SVG, l = Object.assign({}, this._group.options.spiderLegPolylineOptions), u = l.opacity, d, f, p, m, h, g;
|
|
690
|
+
for (u === void 0 && (u = e.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity), c ? (l.opacity = 0, l.className = `${l.className || ""} leaflet-cluster-spider-leg`) : l.opacity = u, r._ignoreMove = !0, d = 0; d < t.length; d++) f = t[d], g = i.layerPointToLatLng(n[d]), p = new e.Polyline([o, g], l), i.addLayer(p), f._spiderLeg = p, c && (m = p._path, h = m.getTotalLength() + .1, m.style.strokeDasharray = h, m.style.strokeDashoffset = h), f.setZIndexOffset && f.setZIndexOffset(1e6), f.clusterHide && f.clusterHide(), a.addLayer(f), f._setPos && f._setPos(s);
|
|
691
|
+
for (r._forceLayout(), r._animationStart(), d = t.length - 1; d >= 0; d--) g = i.layerPointToLatLng(n[d]), f = t[d], f._preSpiderfyLatlng = f._latlng, f.setLatLng(g), f.clusterShow && f.clusterShow(), c && (p = f._spiderLeg, m = p._path, m.style.strokeDashoffset = 0, p.setStyle({ opacity: u }));
|
|
692
|
+
this.setOpacity(.3), r._ignoreMove = !1, setTimeout(() => {
|
|
693
|
+
r._animationEnd(), r.fire("spiderfied", {
|
|
694
|
+
cluster: this,
|
|
695
|
+
markers: t
|
|
696
|
+
});
|
|
697
|
+
}, 200);
|
|
698
|
+
},
|
|
699
|
+
_animationUnspiderfy: function(t) {
|
|
700
|
+
var n = this._group, r = n._map, i = n._featureGroup, a = t ? r._latLngToNewLayerPoint(this._latlng, t.zoom, t.center) : r.latLngToLayerPoint(this._latlng), o = this.getAllChildMarkers(), s = e.Path.SVG, c, l, u, d, f, p;
|
|
701
|
+
for (n._ignoreMove = !0, n._animationStart(), this.setOpacity(1), l = o.length - 1; l >= 0; l--) c = o[l], c._preSpiderfyLatlng && (c.closePopup(), c.setLatLng(c._preSpiderfyLatlng), delete c._preSpiderfyLatlng, p = !0, c._setPos && (c._setPos(a), p = !1), c.clusterHide && (c.clusterHide(), p = !1), p && i.removeLayer(c), s && (u = c._spiderLeg, d = u._path, f = d.getTotalLength() + .1, d.style.strokeDashoffset = f, u.setStyle({ opacity: 0 })));
|
|
702
|
+
n._ignoreMove = !1, setTimeout(() => {
|
|
703
|
+
var e = 0;
|
|
704
|
+
for (l = o.length - 1; l >= 0; l--) c = o[l], c._spiderLeg && e++;
|
|
705
|
+
for (l = o.length - 1; l >= 0; l--) c = o[l], c._spiderLeg && (c.clusterShow && c.clusterShow(), c.setZIndexOffset && c.setZIndexOffset(0), e > 1 && i.removeLayer(c), r.removeLayer(c._spiderLeg), delete c._spiderLeg);
|
|
706
|
+
n._animationEnd(), n.fire("unspiderfied", {
|
|
707
|
+
cluster: this,
|
|
708
|
+
markers: o
|
|
709
|
+
});
|
|
710
|
+
}, 200);
|
|
711
|
+
}
|
|
712
|
+
}), e.MarkerClusterGroup.include({
|
|
713
|
+
_spiderfied: null,
|
|
714
|
+
unspiderfy: function(...e) {
|
|
715
|
+
this._unspiderfy.apply(this, e);
|
|
716
|
+
},
|
|
717
|
+
_spiderfierOnAdd: function() {
|
|
718
|
+
this._map.on("click", this._unspiderfyWrapper, this), this._map.options.zoomAnimation && this._map.on("zoomstart", this._unspiderfyZoomStart, this), this._map.on("zoomend", this._noanimationUnspiderfy, this), e.Browser.touch || this._map.getRenderer(this);
|
|
719
|
+
},
|
|
720
|
+
_spiderfierOnRemove: function() {
|
|
721
|
+
this._map.off("click", this._unspiderfyWrapper, this), this._map.off("zoomstart", this._unspiderfyZoomStart, this), this._map.off("zoomanim", this._unspiderfyZoomAnim, this), this._map.off("zoomend", this._noanimationUnspiderfy, this), this._noanimationUnspiderfy();
|
|
722
|
+
},
|
|
723
|
+
_unspiderfyZoomStart: function() {
|
|
724
|
+
this._map && this._map.on("zoomanim", this._unspiderfyZoomAnim, this);
|
|
725
|
+
},
|
|
726
|
+
_unspiderfyZoomAnim: function(e) {
|
|
727
|
+
this._map._mapPane.classList.contains("leaflet-touching") || (this._map.off("zoomanim", this._unspiderfyZoomAnim, this), this._unspiderfy(e));
|
|
728
|
+
},
|
|
729
|
+
_unspiderfyWrapper: function() {
|
|
730
|
+
this._unspiderfy();
|
|
731
|
+
},
|
|
732
|
+
_unspiderfy: function(e) {
|
|
733
|
+
this._spiderfied && this._spiderfied.unspiderfy(e);
|
|
734
|
+
},
|
|
735
|
+
_noanimationUnspiderfy: function() {
|
|
736
|
+
this._spiderfied && this._spiderfied._noanimationUnspiderfy();
|
|
737
|
+
},
|
|
738
|
+
_unspiderfyLayer: function(e) {
|
|
739
|
+
e._spiderLeg && (this._featureGroup.removeLayer(e), e.clusterShow && e.clusterShow(), e.setZIndexOffset && e.setZIndexOffset(0), this._map.removeLayer(e._spiderLeg), delete e._spiderLeg);
|
|
740
|
+
}
|
|
741
|
+
}), e.MarkerClusterGroup.include({
|
|
742
|
+
refreshClusters: function(t) {
|
|
743
|
+
return t ? t instanceof e.MarkerClusterGroup ? t = t._topClusterLevel.getAllChildMarkers() : t instanceof e.LayerGroup ? t = t._layers : t instanceof e.MarkerCluster ? t = t.getAllChildMarkers() : t instanceof e.Marker && (t = [t]) : t = this._topClusterLevel.getAllChildMarkers(), this._flagParentsIconsNeedUpdate(t), this._refreshClustersIcons(), this.options.singleMarkerMode && this._refreshSingleMarkerModeMarkers(t), this;
|
|
744
|
+
},
|
|
745
|
+
_flagParentsIconsNeedUpdate: (e) => {
|
|
746
|
+
var t, n;
|
|
747
|
+
for (t in e) for (n = e[t].__parent; n;) n._iconNeedsUpdate = !0, n = n.__parent;
|
|
748
|
+
},
|
|
749
|
+
_refreshSingleMarkerModeMarkers: function(e) {
|
|
750
|
+
var t, n;
|
|
751
|
+
for (t in e) n = e[t], this.hasLayer(n) && n.setIcon(this._overrideMarkerIcon(n));
|
|
752
|
+
}
|
|
753
|
+
}), e.Marker.include({ refreshIconOptions: function(t, n) {
|
|
754
|
+
var r = this.options.icon;
|
|
755
|
+
return e.setOptions(r, t), this.setIcon(r), n && this.__parent && this.__parent._group.refreshClusters(this), this;
|
|
756
|
+
} });
|
|
757
|
+
//#endregion
|
|
758
|
+
|
|
759
|
+
//# sourceMappingURL=cluster.js.map
|