vue3-google-map 0.16.0 → 0.17.0
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/README.md +5 -1
- package/dist/index.cjs.js +7 -7
- package/dist/index.es.js +819 -620
- package/dist/index.umd.js +7 -7
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var d=document.createElement("style");d.appendChild(document.createTextNode(".mapdiv[data-v-7d660dd5]{width:100%;height:100%}.info-window-wrapper[data-v-45a4606d]{display:none}.mapdiv .info-window-wrapper[data-v-45a4606d]{display:inline-block}.custom-marker-wrapper[data-v-c7599d50]{display:none}.mapdiv .custom-marker-wrapper[data-v-c7599d50]{display:inline-block}")),document.head.appendChild(d)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
import { defineComponent as
|
|
6
|
-
const
|
|
2
|
+
var Be = Object.defineProperty;
|
|
3
|
+
var qe = (o, e, t) => e in o ? Be(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
4
|
+
var te = (o, e, t) => (qe(o, typeof e != "symbol" ? e + "" : e, t), t);
|
|
5
|
+
import { defineComponent as M, ref as v, provide as z, watch as O, onMounted as Me, onBeforeUnmount as j, markRaw as E, toRef as B, openBlock as J, createElementBlock as Y, createElementVNode as ie, renderSlot as X, normalizeProps as Re, guardReactiveProps as Ze, inject as _, computed as K, withDirectives as Ne, vShow as Fe, Comment as be, mergeProps as Oe, createCommentVNode as Pe } from "vue";
|
|
6
|
+
const q = Symbol("map"), R = Symbol("api"), xe = Symbol("marker"), Ee = Symbol("markerCluster"), Q = Symbol("CustomMarker"), Le = Symbol("mapTilesLoaded"), $ = [
|
|
7
7
|
"click",
|
|
8
8
|
"dblclick",
|
|
9
9
|
"drag",
|
|
@@ -16,18 +16,18 @@ const I = Symbol("map"), E = Symbol("api"), _e = Symbol("marker"), ke = Symbol("
|
|
|
16
16
|
"mouseup",
|
|
17
17
|
"rightclick"
|
|
18
18
|
];
|
|
19
|
-
var
|
|
19
|
+
var De = function o(e, t) {
|
|
20
20
|
if (e === t)
|
|
21
21
|
return !0;
|
|
22
22
|
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
23
23
|
if (e.constructor !== t.constructor)
|
|
24
24
|
return !1;
|
|
25
|
-
var
|
|
25
|
+
var s, r, n;
|
|
26
26
|
if (Array.isArray(e)) {
|
|
27
|
-
if (
|
|
27
|
+
if (s = e.length, s != t.length)
|
|
28
28
|
return !1;
|
|
29
|
-
for (
|
|
30
|
-
if (!o(e[
|
|
29
|
+
for (r = s; r-- !== 0; )
|
|
30
|
+
if (!o(e[r], t[r]))
|
|
31
31
|
return !1;
|
|
32
32
|
return !0;
|
|
33
33
|
}
|
|
@@ -37,13 +37,13 @@ var Ee = function o(e, t) {
|
|
|
37
37
|
return e.valueOf() === t.valueOf();
|
|
38
38
|
if (e.toString !== Object.prototype.toString)
|
|
39
39
|
return e.toString() === t.toString();
|
|
40
|
-
if (
|
|
40
|
+
if (n = Object.keys(e), s = n.length, s !== Object.keys(t).length)
|
|
41
41
|
return !1;
|
|
42
|
-
for (
|
|
43
|
-
if (!Object.prototype.hasOwnProperty.call(t, r
|
|
42
|
+
for (r = s; r-- !== 0; )
|
|
43
|
+
if (!Object.prototype.hasOwnProperty.call(t, n[r]))
|
|
44
44
|
return !1;
|
|
45
|
-
for (
|
|
46
|
-
var a = r
|
|
45
|
+
for (r = s; r-- !== 0; ) {
|
|
46
|
+
var a = n[r];
|
|
47
47
|
if (!o(e[a], t[a]))
|
|
48
48
|
return !1;
|
|
49
49
|
}
|
|
@@ -51,8 +51,8 @@ var Ee = function o(e, t) {
|
|
|
51
51
|
}
|
|
52
52
|
return e !== e && t !== t;
|
|
53
53
|
};
|
|
54
|
-
const
|
|
55
|
-
class
|
|
54
|
+
const ue = "__googleMapsScriptId";
|
|
55
|
+
class S {
|
|
56
56
|
/**
|
|
57
57
|
* Creates an instance of Loader using [[LoaderOptions]]. No defaults are set
|
|
58
58
|
* using this library, instead the defaults are set by the Google Maps
|
|
@@ -62,13 +62,13 @@ class O {
|
|
|
62
62
|
* const loader = Loader({apiKey, version: 'weekly', libraries: ['places']});
|
|
63
63
|
* ```
|
|
64
64
|
*/
|
|
65
|
-
constructor({ apiKey: e, channel: t, client:
|
|
66
|
-
if (this.CALLBACK = "__googleMapsCallback", this.callbacks = [], this.done = !1, this.loading = !1, this.errors = [], this.version = i, this.apiKey = e, this.channel = t, this.client =
|
|
67
|
-
if (!
|
|
68
|
-
throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(
|
|
69
|
-
return
|
|
65
|
+
constructor({ apiKey: e, channel: t, client: s, id: r = ue, libraries: n = [], language: a, region: c, version: i, mapIds: d, nonce: u, retries: l = 3, url: h = "https://maps.googleapis.com/maps/api/js" }) {
|
|
66
|
+
if (this.CALLBACK = "__googleMapsCallback", this.callbacks = [], this.done = !1, this.loading = !1, this.errors = [], this.version = i, this.apiKey = e, this.channel = t, this.client = s, this.id = r || ue, this.libraries = n, this.language = a, this.region = c, this.mapIds = d, this.nonce = u, this.retries = l, this.url = h, S.instance) {
|
|
67
|
+
if (!De(this.options, S.instance.options))
|
|
68
|
+
throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(S.instance.options)}`);
|
|
69
|
+
return S.instance;
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
S.instance = this;
|
|
72
72
|
}
|
|
73
73
|
get options() {
|
|
74
74
|
return {
|
|
@@ -114,8 +114,8 @@ class O {
|
|
|
114
114
|
*/
|
|
115
115
|
loadPromise() {
|
|
116
116
|
return new Promise((e, t) => {
|
|
117
|
-
this.loadCallback((
|
|
118
|
-
|
|
117
|
+
this.loadCallback((s) => {
|
|
118
|
+
s ? t(s.error) : e(window.google);
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
121
|
}
|
|
@@ -174,14 +174,14 @@ class O {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function Ue(o) {
|
|
178
178
|
return class extends o.OverlayView {
|
|
179
|
-
constructor(
|
|
179
|
+
constructor(s) {
|
|
180
180
|
super();
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const { element:
|
|
184
|
-
this.element =
|
|
181
|
+
te(this, "element");
|
|
182
|
+
te(this, "opts");
|
|
183
|
+
const { element: r, ...n } = s;
|
|
184
|
+
this.element = r, this.opts = n, this.opts.map && this.setMap(this.opts.map);
|
|
185
185
|
}
|
|
186
186
|
getPosition() {
|
|
187
187
|
return this.opts.position ? this.opts.position instanceof o.LatLng ? this.opts.position : new o.LatLng(this.opts.position) : null;
|
|
@@ -189,64 +189,64 @@ function $e(o) {
|
|
|
189
189
|
getVisible() {
|
|
190
190
|
if (!this.element)
|
|
191
191
|
return !1;
|
|
192
|
-
const
|
|
193
|
-
return
|
|
192
|
+
const s = this.element;
|
|
193
|
+
return s.style.display !== "none" && s.style.visibility !== "hidden" && (s.style.opacity === "" || Number(s.style.opacity) > 0.01);
|
|
194
194
|
}
|
|
195
195
|
onAdd() {
|
|
196
196
|
if (!this.element)
|
|
197
197
|
return;
|
|
198
|
-
const
|
|
199
|
-
|
|
198
|
+
const s = this.getPanes();
|
|
199
|
+
s && s.overlayMouseTarget.appendChild(this.element);
|
|
200
200
|
}
|
|
201
201
|
draw() {
|
|
202
202
|
if (!this.element)
|
|
203
203
|
return;
|
|
204
|
-
const
|
|
205
|
-
if (
|
|
204
|
+
const r = this.getProjection().fromLatLngToDivPixel(this.getPosition());
|
|
205
|
+
if (r) {
|
|
206
206
|
this.element.style.position = "absolute";
|
|
207
|
-
const
|
|
208
|
-
let
|
|
207
|
+
const n = this.element.offsetHeight, a = this.element.offsetWidth;
|
|
208
|
+
let c, i;
|
|
209
209
|
switch (this.opts.anchorPoint) {
|
|
210
210
|
case "TOP_CENTER":
|
|
211
|
-
|
|
211
|
+
c = r.x - a / 2, i = r.y;
|
|
212
212
|
break;
|
|
213
213
|
case "BOTTOM_CENTER":
|
|
214
|
-
|
|
214
|
+
c = r.x - a / 2, i = r.y - n;
|
|
215
215
|
break;
|
|
216
216
|
case "LEFT_CENTER":
|
|
217
|
-
|
|
217
|
+
c = r.x, i = r.y - n / 2;
|
|
218
218
|
break;
|
|
219
219
|
case "RIGHT_CENTER":
|
|
220
|
-
|
|
220
|
+
c = r.x - a, i = r.y - n / 2;
|
|
221
221
|
break;
|
|
222
222
|
case "TOP_LEFT":
|
|
223
|
-
|
|
223
|
+
c = r.x, i = r.y;
|
|
224
224
|
break;
|
|
225
225
|
case "TOP_RIGHT":
|
|
226
|
-
|
|
226
|
+
c = r.x - a, i = r.y;
|
|
227
227
|
break;
|
|
228
228
|
case "BOTTOM_LEFT":
|
|
229
|
-
|
|
229
|
+
c = r.x, i = r.y - n;
|
|
230
230
|
break;
|
|
231
231
|
case "BOTTOM_RIGHT":
|
|
232
|
-
|
|
232
|
+
c = r.x - a, i = r.y - n;
|
|
233
233
|
break;
|
|
234
234
|
default:
|
|
235
|
-
|
|
235
|
+
c = r.x - a / 2, i = r.y - n / 2;
|
|
236
236
|
}
|
|
237
|
-
this.element.style.left =
|
|
237
|
+
this.element.style.left = c + "px", this.element.style.top = i + "px", this.element.style.transform = `translateX(${this.opts.offsetX || 0}px) translateY(${this.opts.offsetY || 0}px)`, this.opts.zIndex && (this.element.style.zIndex = this.opts.zIndex.toString());
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
onRemove() {
|
|
241
241
|
this.element && this.element.remove();
|
|
242
242
|
}
|
|
243
|
-
setOptions(
|
|
244
|
-
this.opts =
|
|
243
|
+
setOptions(s) {
|
|
244
|
+
this.opts = s, this.draw();
|
|
245
245
|
}
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
|
-
let
|
|
249
|
-
const
|
|
248
|
+
let de;
|
|
249
|
+
const he = [
|
|
250
250
|
"bounds_changed",
|
|
251
251
|
"center_changed",
|
|
252
252
|
"click",
|
|
@@ -266,7 +266,7 @@ const re = [
|
|
|
266
266
|
"tilesloaded",
|
|
267
267
|
"tilt_changed",
|
|
268
268
|
"zoom_changed"
|
|
269
|
-
],
|
|
269
|
+
], ze = M({
|
|
270
270
|
props: {
|
|
271
271
|
apiPromise: {
|
|
272
272
|
type: Promise
|
|
@@ -454,104 +454,104 @@ const re = [
|
|
|
454
454
|
required: !1
|
|
455
455
|
}
|
|
456
456
|
},
|
|
457
|
-
emits:
|
|
457
|
+
emits: he,
|
|
458
458
|
setup(o, { emit: e }) {
|
|
459
|
-
const t = v(),
|
|
460
|
-
q
|
|
461
|
-
const
|
|
462
|
-
const
|
|
463
|
-
Object.keys(
|
|
464
|
-
|
|
459
|
+
const t = v(), s = v(!1), r = v(), n = v(), a = v(!1);
|
|
460
|
+
z(q, r), z(R, n), z(Le, a);
|
|
461
|
+
const c = () => {
|
|
462
|
+
const l = { ...o };
|
|
463
|
+
Object.keys(l).forEach((m) => {
|
|
464
|
+
l[m] === void 0 && delete l[m];
|
|
465
465
|
});
|
|
466
|
-
const
|
|
466
|
+
const p = (m) => {
|
|
467
467
|
var g;
|
|
468
|
-
return m ? { position: (g =
|
|
469
|
-
},
|
|
468
|
+
return m ? { position: (g = n.value) == null ? void 0 : g.ControlPosition[m] } : {};
|
|
469
|
+
}, f = {
|
|
470
470
|
scaleControlOptions: o.scaleControlStyle ? { style: o.scaleControlStyle } : {},
|
|
471
|
-
panControlOptions:
|
|
472
|
-
zoomControlOptions:
|
|
473
|
-
rotateControlOptions:
|
|
474
|
-
streetViewControlOptions:
|
|
475
|
-
fullscreenControlOptions:
|
|
471
|
+
panControlOptions: p(o.panControlPosition),
|
|
472
|
+
zoomControlOptions: p(o.zoomControlPosition),
|
|
473
|
+
rotateControlOptions: p(o.rotateControlPosition),
|
|
474
|
+
streetViewControlOptions: p(o.streetViewControlPosition),
|
|
475
|
+
fullscreenControlOptions: p(o.fullscreenControlPosition),
|
|
476
476
|
disableDefaultUI: o.disableDefaultUi
|
|
477
477
|
};
|
|
478
|
-
return { ...
|
|
479
|
-
}, i =
|
|
480
|
-
[
|
|
481
|
-
([
|
|
482
|
-
const
|
|
483
|
-
|
|
478
|
+
return { ...l, ...f };
|
|
479
|
+
}, i = O(
|
|
480
|
+
[n, r],
|
|
481
|
+
([l, h]) => {
|
|
482
|
+
const p = l, f = h;
|
|
483
|
+
p && f && (p.event.addListenerOnce(f, "tilesloaded", () => {
|
|
484
484
|
a.value = !0;
|
|
485
485
|
}), setTimeout(i, 0));
|
|
486
486
|
},
|
|
487
487
|
{ immediate: !0 }
|
|
488
|
-
),
|
|
488
|
+
), d = () => {
|
|
489
489
|
try {
|
|
490
|
-
const { apiKey:
|
|
491
|
-
|
|
492
|
-
} catch (
|
|
493
|
-
console.error(
|
|
490
|
+
const { apiKey: l, region: h, version: p, language: f, libraries: m } = o;
|
|
491
|
+
de = new S({ apiKey: l, region: h, version: p, language: f, libraries: m });
|
|
492
|
+
} catch (l) {
|
|
493
|
+
console.error(l);
|
|
494
494
|
}
|
|
495
|
-
}, u = (
|
|
496
|
-
|
|
497
|
-
const h =
|
|
498
|
-
|
|
495
|
+
}, u = (l) => {
|
|
496
|
+
n.value = E(l.maps), r.value = E(new l.maps.Map(t.value, c()));
|
|
497
|
+
const h = Ue(n.value);
|
|
498
|
+
n.value[Q] = h, he.forEach((f) => {
|
|
499
499
|
var m;
|
|
500
|
-
(m =
|
|
501
|
-
}),
|
|
502
|
-
const
|
|
503
|
-
(
|
|
504
|
-
).map((
|
|
505
|
-
|
|
506
|
-
[() => o.center, () => o.zoom, ...
|
|
507
|
-
([
|
|
508
|
-
var
|
|
509
|
-
const { center: w, zoom:
|
|
510
|
-
(
|
|
511
|
-
const
|
|
512
|
-
|
|
500
|
+
(m = r.value) == null || m.addListener(f, (g) => e(f, g));
|
|
501
|
+
}), s.value = !0;
|
|
502
|
+
const p = Object.keys(o).filter(
|
|
503
|
+
(f) => !["apiPromise", "apiKey", "version", "libraries", "region", "language", "center", "zoom"].includes(f)
|
|
504
|
+
).map((f) => B(o, f));
|
|
505
|
+
O(
|
|
506
|
+
[() => o.center, () => o.zoom, ...p],
|
|
507
|
+
([f, m], [g, y]) => {
|
|
508
|
+
var G, b, F;
|
|
509
|
+
const { center: w, zoom: C, ...T } = c();
|
|
510
|
+
(G = r.value) == null || G.setOptions(T), m !== void 0 && m !== y && ((b = r.value) == null || b.setZoom(m));
|
|
511
|
+
const N = !g || f.lng !== g.lng || f.lat !== g.lat;
|
|
512
|
+
f && N && ((F = r.value) == null || F.panTo(f));
|
|
513
513
|
}
|
|
514
514
|
);
|
|
515
515
|
};
|
|
516
|
-
return
|
|
517
|
-
o.apiPromise && o.apiPromise instanceof Promise ? o.apiPromise.then(u) : (
|
|
518
|
-
}),
|
|
519
|
-
var
|
|
520
|
-
a.value = !1,
|
|
521
|
-
}), { mapRef: t, ready:
|
|
516
|
+
return Me(() => {
|
|
517
|
+
o.apiPromise && o.apiPromise instanceof Promise ? o.apiPromise.then(u) : (d(), de.load().then(u));
|
|
518
|
+
}), j(() => {
|
|
519
|
+
var l;
|
|
520
|
+
a.value = !1, r.value && ((l = n.value) == null || l.event.clearInstanceListeners(r.value));
|
|
521
|
+
}), { mapRef: t, ready: s, map: r, api: n, mapTilesLoaded: a };
|
|
522
522
|
}
|
|
523
523
|
});
|
|
524
|
-
const
|
|
524
|
+
const ee = (o, e) => {
|
|
525
525
|
const t = o.__vccOpts || o;
|
|
526
|
-
for (const [
|
|
527
|
-
t[
|
|
526
|
+
for (const [s, r] of e)
|
|
527
|
+
t[s] = r;
|
|
528
528
|
return t;
|
|
529
|
-
},
|
|
529
|
+
}, Ve = {
|
|
530
530
|
ref: "mapRef",
|
|
531
531
|
class: "mapdiv"
|
|
532
532
|
};
|
|
533
|
-
function
|
|
534
|
-
return
|
|
535
|
-
|
|
536
|
-
|
|
533
|
+
function Ge(o, e, t, s, r, n) {
|
|
534
|
+
return J(), Y("div", null, [
|
|
535
|
+
ie("div", Ve, null, 512),
|
|
536
|
+
X(o.$slots, "default", Re(Ze({ ready: o.ready, map: o.map, api: o.api, mapTilesLoaded: o.mapTilesLoaded })), void 0, !0)
|
|
537
537
|
]);
|
|
538
538
|
}
|
|
539
|
-
const
|
|
540
|
-
function
|
|
539
|
+
const Ot = /* @__PURE__ */ ee(ze, [["render", Ge], ["__scopeId", "data-v-7d660dd5"]]);
|
|
540
|
+
function He(o) {
|
|
541
541
|
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
542
542
|
}
|
|
543
|
-
var
|
|
543
|
+
var We = function o(e, t) {
|
|
544
544
|
if (e === t)
|
|
545
545
|
return !0;
|
|
546
546
|
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
547
547
|
if (e.constructor !== t.constructor)
|
|
548
548
|
return !1;
|
|
549
|
-
var
|
|
549
|
+
var s, r, n;
|
|
550
550
|
if (Array.isArray(e)) {
|
|
551
|
-
if (
|
|
551
|
+
if (s = e.length, s != t.length)
|
|
552
552
|
return !1;
|
|
553
|
-
for (
|
|
554
|
-
if (!o(e[
|
|
553
|
+
for (r = s; r-- !== 0; )
|
|
554
|
+
if (!o(e[r], t[r]))
|
|
555
555
|
return !1;
|
|
556
556
|
return !0;
|
|
557
557
|
}
|
|
@@ -561,13 +561,13 @@ var Ae = function o(e, t) {
|
|
|
561
561
|
return e.valueOf() === t.valueOf();
|
|
562
562
|
if (e.toString !== Object.prototype.toString)
|
|
563
563
|
return e.toString() === t.toString();
|
|
564
|
-
if (
|
|
564
|
+
if (n = Object.keys(e), s = n.length, s !== Object.keys(t).length)
|
|
565
565
|
return !1;
|
|
566
|
-
for (
|
|
567
|
-
if (!Object.prototype.hasOwnProperty.call(t, r
|
|
566
|
+
for (r = s; r-- !== 0; )
|
|
567
|
+
if (!Object.prototype.hasOwnProperty.call(t, n[r]))
|
|
568
568
|
return !1;
|
|
569
|
-
for (
|
|
570
|
-
var a = r
|
|
569
|
+
for (r = s; r-- !== 0; ) {
|
|
570
|
+
var a = n[r];
|
|
571
571
|
if (!o(e[a], t[a]))
|
|
572
572
|
return !1;
|
|
573
573
|
}
|
|
@@ -575,37 +575,37 @@ var Ae = function o(e, t) {
|
|
|
575
575
|
}
|
|
576
576
|
return e !== e && t !== t;
|
|
577
577
|
};
|
|
578
|
-
const A = /* @__PURE__ */
|
|
579
|
-
const
|
|
580
|
-
() => !!(
|
|
578
|
+
const A = /* @__PURE__ */ He(We), Ke = (o) => o === "Marker", Je = (o) => o === Q, Z = (o, e, t, s) => {
|
|
579
|
+
const r = v(), n = _(q, v()), a = _(R, v()), c = _(Ee, v()), i = K(
|
|
580
|
+
() => !!(c.value && a.value && (r.value instanceof a.value.Marker || r.value instanceof a.value[Q]))
|
|
581
581
|
);
|
|
582
|
-
return
|
|
583
|
-
[
|
|
584
|
-
(
|
|
585
|
-
var
|
|
586
|
-
const h = !A(t.value,
|
|
587
|
-
!
|
|
582
|
+
return O(
|
|
583
|
+
[n, t],
|
|
584
|
+
(d, [u, l]) => {
|
|
585
|
+
var p, f, m;
|
|
586
|
+
const h = !A(t.value, l) || n.value !== u;
|
|
587
|
+
!n.value || !a.value || !h || (r.value ? (r.value.setOptions(t.value), i.value && ((p = c.value) == null || p.removeMarker(r.value), (f = c.value) == null || f.addMarker(r.value))) : (Ke(o) ? r.value = E(
|
|
588
588
|
new a.value[o](t.value)
|
|
589
|
-
) :
|
|
589
|
+
) : Je(o) ? r.value = E(
|
|
590
590
|
new a.value[o](t.value)
|
|
591
|
-
) :
|
|
591
|
+
) : r.value = E(
|
|
592
592
|
new a.value[o]({
|
|
593
593
|
...t.value,
|
|
594
|
-
map:
|
|
594
|
+
map: n.value
|
|
595
595
|
})
|
|
596
|
-
), i.value ? (m =
|
|
597
|
-
var
|
|
598
|
-
(
|
|
596
|
+
), i.value ? (m = c.value) == null || m.addMarker(r.value) : r.value.setMap(n.value), e.forEach((g) => {
|
|
597
|
+
var y;
|
|
598
|
+
(y = r.value) == null || y.addListener(g, (w) => s(g, w));
|
|
599
599
|
})));
|
|
600
600
|
},
|
|
601
601
|
{
|
|
602
602
|
immediate: !0
|
|
603
603
|
}
|
|
604
|
-
),
|
|
605
|
-
var
|
|
606
|
-
|
|
607
|
-
}),
|
|
608
|
-
},
|
|
604
|
+
), j(() => {
|
|
605
|
+
var d, u;
|
|
606
|
+
r.value && ((d = a.value) == null || d.event.clearInstanceListeners(r.value), i.value ? (u = c.value) == null || u.removeMarker(r.value) : r.value.setMap(null));
|
|
607
|
+
}), r;
|
|
608
|
+
}, pe = [
|
|
609
609
|
"animation_changed",
|
|
610
610
|
"click",
|
|
611
611
|
"dblclick",
|
|
@@ -629,7 +629,7 @@ const A = /* @__PURE__ */ Re(Ae), Ze = (o) => o === "Marker", Be = (o) => o ===
|
|
|
629
629
|
"shape_changed",
|
|
630
630
|
"title_changed",
|
|
631
631
|
"visible_changed"
|
|
632
|
-
],
|
|
632
|
+
], Pt = M({
|
|
633
633
|
name: "Marker",
|
|
634
634
|
props: {
|
|
635
635
|
options: {
|
|
@@ -637,15 +637,15 @@ const A = /* @__PURE__ */ Re(Ae), Ze = (o) => o === "Marker", Be = (o) => o ===
|
|
|
637
637
|
required: !0
|
|
638
638
|
}
|
|
639
639
|
},
|
|
640
|
-
emits:
|
|
641
|
-
setup(o, { emit: e, expose: t, slots:
|
|
642
|
-
const
|
|
643
|
-
return
|
|
640
|
+
emits: pe,
|
|
641
|
+
setup(o, { emit: e, expose: t, slots: s }) {
|
|
642
|
+
const r = B(o, "options"), n = Z("Marker", pe, r, e);
|
|
643
|
+
return z(xe, n), t({ marker: n }), () => {
|
|
644
644
|
var a;
|
|
645
|
-
return (a =
|
|
645
|
+
return (a = s.default) == null ? void 0 : a.call(s);
|
|
646
646
|
};
|
|
647
647
|
}
|
|
648
|
-
}),
|
|
648
|
+
}), xt = M({
|
|
649
649
|
name: "Polyline",
|
|
650
650
|
props: {
|
|
651
651
|
options: {
|
|
@@ -653,13 +653,13 @@ const A = /* @__PURE__ */ Re(Ae), Ze = (o) => o === "Marker", Be = (o) => o ===
|
|
|
653
653
|
required: !0
|
|
654
654
|
}
|
|
655
655
|
},
|
|
656
|
-
emits:
|
|
656
|
+
emits: $,
|
|
657
657
|
setup(o, { emit: e }) {
|
|
658
|
-
const t =
|
|
659
|
-
return { polyline:
|
|
658
|
+
const t = B(o, "options");
|
|
659
|
+
return { polyline: Z("Polyline", $, t, e) };
|
|
660
660
|
},
|
|
661
661
|
render: () => null
|
|
662
|
-
}),
|
|
662
|
+
}), Et = M({
|
|
663
663
|
name: "Polygon",
|
|
664
664
|
props: {
|
|
665
665
|
options: {
|
|
@@ -667,13 +667,13 @@ const A = /* @__PURE__ */ Re(Ae), Ze = (o) => o === "Marker", Be = (o) => o ===
|
|
|
667
667
|
required: !0
|
|
668
668
|
}
|
|
669
669
|
},
|
|
670
|
-
emits:
|
|
670
|
+
emits: $,
|
|
671
671
|
setup(o, { emit: e }) {
|
|
672
|
-
const t =
|
|
673
|
-
return { polygon:
|
|
672
|
+
const t = B(o, "options");
|
|
673
|
+
return { polygon: Z("Polygon", $, t, e) };
|
|
674
674
|
},
|
|
675
675
|
render: () => null
|
|
676
|
-
}),
|
|
676
|
+
}), fe = $.concat(["bounds_changed"]), Lt = M({
|
|
677
677
|
name: "Rectangle",
|
|
678
678
|
props: {
|
|
679
679
|
options: {
|
|
@@ -681,13 +681,13 @@ const A = /* @__PURE__ */ Re(Ae), Ze = (o) => o === "Marker", Be = (o) => o ===
|
|
|
681
681
|
required: !0
|
|
682
682
|
}
|
|
683
683
|
},
|
|
684
|
-
emits:
|
|
684
|
+
emits: fe,
|
|
685
685
|
setup(o, { emit: e }) {
|
|
686
|
-
const t =
|
|
687
|
-
return { rectangle:
|
|
686
|
+
const t = B(o, "options");
|
|
687
|
+
return { rectangle: Z("Rectangle", fe, t, e) };
|
|
688
688
|
},
|
|
689
689
|
render: () => null
|
|
690
|
-
}),
|
|
690
|
+
}), me = $.concat(["center_changed", "radius_changed"]), St = M({
|
|
691
691
|
name: "Circle",
|
|
692
692
|
props: {
|
|
693
693
|
options: {
|
|
@@ -695,13 +695,13 @@ const A = /* @__PURE__ */ Re(Ae), Ze = (o) => o === "Marker", Be = (o) => o ===
|
|
|
695
695
|
required: !0
|
|
696
696
|
}
|
|
697
697
|
},
|
|
698
|
-
emits:
|
|
698
|
+
emits: me,
|
|
699
699
|
setup(o, { emit: e }) {
|
|
700
|
-
const t =
|
|
701
|
-
return { circle:
|
|
700
|
+
const t = B(o, "options");
|
|
701
|
+
return { circle: Z("Circle", me, t, e) };
|
|
702
702
|
},
|
|
703
703
|
render: () => null
|
|
704
|
-
}),
|
|
704
|
+
}), Ye = M({
|
|
705
705
|
props: {
|
|
706
706
|
position: {
|
|
707
707
|
type: String,
|
|
@@ -714,47 +714,47 @@ const A = /* @__PURE__ */ Re(Ae), Ze = (o) => o === "Marker", Be = (o) => o ===
|
|
|
714
714
|
},
|
|
715
715
|
emits: ["content:loaded"],
|
|
716
716
|
setup(o, { emit: e }) {
|
|
717
|
-
const t = v(null),
|
|
718
|
-
[
|
|
719
|
-
([u,
|
|
720
|
-
|
|
717
|
+
const t = v(null), s = _(q, v()), r = _(R, v()), n = _(Le, v(!1)), a = v(!1), c = O(
|
|
718
|
+
[n, r, t],
|
|
719
|
+
([u, l, h]) => {
|
|
720
|
+
l && u && h && (i(o.position), a.value = !0, e("content:loaded"), setTimeout(c, 0));
|
|
721
721
|
},
|
|
722
722
|
{ immediate: !0 }
|
|
723
723
|
), i = (u) => {
|
|
724
|
-
if (
|
|
725
|
-
const
|
|
726
|
-
|
|
724
|
+
if (s.value && r.value && t.value) {
|
|
725
|
+
const l = r.value.ControlPosition[u];
|
|
726
|
+
s.value.controls[l].push(t.value);
|
|
727
727
|
}
|
|
728
|
-
},
|
|
729
|
-
if (
|
|
730
|
-
let
|
|
731
|
-
const h =
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
}),
|
|
728
|
+
}, d = (u) => {
|
|
729
|
+
if (s.value && r.value) {
|
|
730
|
+
let l = null;
|
|
731
|
+
const h = r.value.ControlPosition[u];
|
|
732
|
+
s.value.controls[h].forEach((p, f) => {
|
|
733
|
+
p === t.value && (l = f);
|
|
734
|
+
}), l !== null && s.value.controls[h].removeAt(l);
|
|
735
735
|
}
|
|
736
736
|
};
|
|
737
|
-
return
|
|
737
|
+
return j(() => d(o.position)), O(
|
|
738
738
|
() => o.position,
|
|
739
|
-
(u,
|
|
740
|
-
|
|
739
|
+
(u, l) => {
|
|
740
|
+
d(l), i(u);
|
|
741
741
|
}
|
|
742
|
-
),
|
|
742
|
+
), O(
|
|
743
743
|
() => o.index,
|
|
744
744
|
(u) => {
|
|
745
745
|
u && t.value && (t.value.index = o.index);
|
|
746
746
|
}
|
|
747
747
|
), { controlRef: t, showContent: a };
|
|
748
748
|
}
|
|
749
|
-
}),
|
|
750
|
-
function
|
|
751
|
-
return
|
|
752
|
-
|
|
749
|
+
}), Xe = { ref: "controlRef" };
|
|
750
|
+
function Qe(o, e, t, s, r, n) {
|
|
751
|
+
return Ne((J(), Y("div", Xe, [
|
|
752
|
+
X(o.$slots, "default")
|
|
753
753
|
], 512)), [
|
|
754
|
-
[
|
|
754
|
+
[Fe, o.showContent]
|
|
755
755
|
]);
|
|
756
756
|
}
|
|
757
|
-
const
|
|
757
|
+
const At = /* @__PURE__ */ ee(Ye, [["render", Qe]]), ge = ["closeclick", "content_changed", "domready", "position_changed", "visible", "zindex_changed"], et = M({
|
|
758
758
|
inheritAttrs: !1,
|
|
759
759
|
props: {
|
|
760
760
|
options: {
|
|
@@ -762,146 +762,212 @@ const bt = /* @__PURE__ */ K(Ne, [["render", De]]), ce = ["closeclick", "content
|
|
|
762
762
|
default: () => ({})
|
|
763
763
|
}
|
|
764
764
|
},
|
|
765
|
-
emits:
|
|
766
|
-
setup(o, { slots: e, emit: t, expose:
|
|
767
|
-
const
|
|
768
|
-
let
|
|
769
|
-
const u =
|
|
765
|
+
emits: ge,
|
|
766
|
+
setup(o, { slots: e, emit: t, expose: s }) {
|
|
767
|
+
const r = v(), n = v(), a = _(q, v()), c = _(R, v()), i = _(xe, v());
|
|
768
|
+
let d;
|
|
769
|
+
const u = K(() => {
|
|
770
|
+
var p;
|
|
771
|
+
return (p = e.default) == null ? void 0 : p.call(e).some((f) => f.type !== be);
|
|
772
|
+
}), l = (p) => {
|
|
770
773
|
var f;
|
|
771
|
-
return (f =
|
|
772
|
-
}), c = (f) => {
|
|
773
|
-
var d;
|
|
774
|
-
return (d = s.value) == null ? void 0 : d.open({ map: a.value, anchor: i.value, ...f });
|
|
774
|
+
return (f = r.value) == null ? void 0 : f.open({ map: a.value, anchor: i.value, ...p });
|
|
775
775
|
}, h = () => {
|
|
776
|
-
var
|
|
777
|
-
return (
|
|
776
|
+
var p;
|
|
777
|
+
return (p = r.value) == null ? void 0 : p.close();
|
|
778
778
|
};
|
|
779
|
-
return
|
|
780
|
-
|
|
779
|
+
return Me(() => {
|
|
780
|
+
O(
|
|
781
781
|
[a, () => o.options],
|
|
782
|
-
([
|
|
783
|
-
const
|
|
784
|
-
a.value &&
|
|
785
|
-
...
|
|
786
|
-
content: u.value ?
|
|
787
|
-
}), i.value ||
|
|
788
|
-
new
|
|
789
|
-
...
|
|
790
|
-
content: u.value ?
|
|
782
|
+
([p, f], [m, g]) => {
|
|
783
|
+
const y = !A(f, g) || a.value !== m;
|
|
784
|
+
a.value && c.value && y && (r.value ? (r.value.setOptions({
|
|
785
|
+
...f,
|
|
786
|
+
content: u.value ? n.value : f.content
|
|
787
|
+
}), i.value || l()) : (r.value = E(
|
|
788
|
+
new c.value.InfoWindow({
|
|
789
|
+
...f,
|
|
790
|
+
content: u.value ? n.value : f.content
|
|
791
791
|
})
|
|
792
|
-
), i.value ?
|
|
793
|
-
|
|
794
|
-
}) :
|
|
795
|
-
var
|
|
796
|
-
(
|
|
792
|
+
), i.value ? d = i.value.addListener("click", () => {
|
|
793
|
+
l();
|
|
794
|
+
}) : l(), ge.forEach((w) => {
|
|
795
|
+
var C;
|
|
796
|
+
(C = r.value) == null || C.addListener(w, (T) => t(w, T));
|
|
797
797
|
})));
|
|
798
798
|
},
|
|
799
799
|
{
|
|
800
800
|
immediate: !0
|
|
801
801
|
}
|
|
802
802
|
);
|
|
803
|
-
}),
|
|
804
|
-
var
|
|
805
|
-
|
|
806
|
-
}),
|
|
803
|
+
}), j(() => {
|
|
804
|
+
var p;
|
|
805
|
+
d && d.remove(), r.value && ((p = c.value) == null || p.event.clearInstanceListeners(r.value), h());
|
|
806
|
+
}), s({ infoWindow: r, open: l, close: h }), { infoWindow: r, infoWindowRef: n, hasSlotContent: u, open: l, close: h };
|
|
807
807
|
}
|
|
808
808
|
});
|
|
809
|
-
const
|
|
809
|
+
const tt = {
|
|
810
810
|
key: 0,
|
|
811
811
|
class: "info-window-wrapper"
|
|
812
812
|
};
|
|
813
|
-
function
|
|
814
|
-
return o.hasSlotContent ? (
|
|
815
|
-
|
|
816
|
-
|
|
813
|
+
function st(o, e, t, s, r, n) {
|
|
814
|
+
return o.hasSlotContent ? (J(), Y("div", tt, [
|
|
815
|
+
ie("div", Oe({ ref: "infoWindowRef" }, o.$attrs), [
|
|
816
|
+
X(o.$slots, "default", {}, void 0, !0)
|
|
817
817
|
], 16)
|
|
818
|
-
])) :
|
|
819
|
-
}
|
|
820
|
-
const Mt = /* @__PURE__ */ K(Fe, [["render", Ue], ["__scopeId", "data-v-45a4606d"]]);
|
|
821
|
-
function J(o, e, t, n, s, r) {
|
|
822
|
-
if (s - n <= t)
|
|
823
|
-
return;
|
|
824
|
-
const a = n + s >> 1;
|
|
825
|
-
be(o, e, a, n, s, r % 2), J(o, e, t, n, a - 1, r + 1), J(o, e, t, a + 1, s, r + 1);
|
|
818
|
+
])) : Pe("", !0);
|
|
826
819
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
820
|
+
const Tt = /* @__PURE__ */ ee(et, [["render", st], ["__scopeId", "data-v-45a4606d"]]), ve = [
|
|
821
|
+
Int8Array,
|
|
822
|
+
Uint8Array,
|
|
823
|
+
Uint8ClampedArray,
|
|
824
|
+
Int16Array,
|
|
825
|
+
Uint16Array,
|
|
826
|
+
Int32Array,
|
|
827
|
+
Uint32Array,
|
|
828
|
+
Float32Array,
|
|
829
|
+
Float64Array
|
|
830
|
+
], se = 1, D = 8;
|
|
831
|
+
class ae {
|
|
832
|
+
/**
|
|
833
|
+
* Creates an index from raw `ArrayBuffer` data.
|
|
834
|
+
* @param {ArrayBuffer} data
|
|
835
|
+
*/
|
|
836
|
+
static from(e) {
|
|
837
|
+
if (!(e instanceof ArrayBuffer))
|
|
838
|
+
throw new Error("Data must be an instance of ArrayBuffer.");
|
|
839
|
+
const [t, s] = new Uint8Array(e, 0, 2);
|
|
840
|
+
if (t !== 219)
|
|
841
|
+
throw new Error("Data does not appear to be in a KDBush format.");
|
|
842
|
+
const r = s >> 4;
|
|
843
|
+
if (r !== se)
|
|
844
|
+
throw new Error(`Got v${r} data when expected v${se}.`);
|
|
845
|
+
const n = ve[s & 15];
|
|
846
|
+
if (!n)
|
|
847
|
+
throw new Error("Unrecognized array type.");
|
|
848
|
+
const [a] = new Uint16Array(e, 2, 1), [c] = new Uint32Array(e, 4, 1);
|
|
849
|
+
return new ae(c, a, n, e);
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Creates an index that will hold a given number of items.
|
|
853
|
+
* @param {number} numItems
|
|
854
|
+
* @param {number} [nodeSize=64] Size of the KD-tree node (64 by default).
|
|
855
|
+
* @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
|
|
856
|
+
* @param {ArrayBuffer} [data] (For internal use only)
|
|
857
|
+
*/
|
|
858
|
+
constructor(e, t = 64, s = Float64Array, r) {
|
|
859
|
+
if (isNaN(e) || e < 0)
|
|
860
|
+
throw new Error(`Unpexpected numItems value: ${e}.`);
|
|
861
|
+
this.numItems = +e, this.nodeSize = Math.min(Math.max(+t, 2), 65535), this.ArrayType = s, this.IndexArrayType = e < 65536 ? Uint16Array : Uint32Array;
|
|
862
|
+
const n = ve.indexOf(this.ArrayType), a = e * 2 * this.ArrayType.BYTES_PER_ELEMENT, c = e * this.IndexArrayType.BYTES_PER_ELEMENT, i = (8 - c % 8) % 8;
|
|
863
|
+
if (n < 0)
|
|
864
|
+
throw new Error(`Unexpected typed array class: ${s}.`);
|
|
865
|
+
r && r instanceof ArrayBuffer ? (this.data = r, this.ids = new this.IndexArrayType(this.data, D, e), this.coords = new this.ArrayType(this.data, D + c + i, e * 2), this._pos = e * 2, this._finished = !0) : (this.data = new ArrayBuffer(D + a + c + i), this.ids = new this.IndexArrayType(this.data, D, e), this.coords = new this.ArrayType(this.data, D + c + i, e * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (se << 4) + n]), new Uint16Array(this.data, 2, 1)[0] = t, new Uint32Array(this.data, 4, 1)[0] = e);
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Add a point to the index.
|
|
869
|
+
* @param {number} x
|
|
870
|
+
* @param {number} y
|
|
871
|
+
* @returns {number} An incremental index associated with the added item (starting from `0`).
|
|
872
|
+
*/
|
|
873
|
+
add(e, t) {
|
|
874
|
+
const s = this._pos >> 1;
|
|
875
|
+
return this.ids[s] = s, this.coords[this._pos++] = e, this.coords[this._pos++] = t, s;
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* Perform indexing of the added points.
|
|
879
|
+
*/
|
|
880
|
+
finish() {
|
|
881
|
+
const e = this._pos >> 1;
|
|
882
|
+
if (e !== this.numItems)
|
|
883
|
+
throw new Error(`Added ${e} items when expected ${this.numItems}.`);
|
|
884
|
+
return ne(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = !0, this;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Search the index for items within a given bounding box.
|
|
888
|
+
* @param {number} minX
|
|
889
|
+
* @param {number} minY
|
|
890
|
+
* @param {number} maxX
|
|
891
|
+
* @param {number} maxY
|
|
892
|
+
* @returns {number[]} An array of indices correponding to the found items.
|
|
893
|
+
*/
|
|
894
|
+
range(e, t, s, r) {
|
|
895
|
+
if (!this._finished)
|
|
896
|
+
throw new Error("Data not yet indexed - call index.finish().");
|
|
897
|
+
const { ids: n, coords: a, nodeSize: c } = this, i = [0, n.length - 1, 0], d = [];
|
|
898
|
+
for (; i.length; ) {
|
|
899
|
+
const u = i.pop() || 0, l = i.pop() || 0, h = i.pop() || 0;
|
|
900
|
+
if (l - h <= c) {
|
|
901
|
+
for (let g = h; g <= l; g++) {
|
|
902
|
+
const y = a[2 * g], w = a[2 * g + 1];
|
|
903
|
+
y >= e && y <= s && w >= t && w <= r && d.push(n[g]);
|
|
904
|
+
}
|
|
905
|
+
continue;
|
|
906
|
+
}
|
|
907
|
+
const p = h + l >> 1, f = a[2 * p], m = a[2 * p + 1];
|
|
908
|
+
f >= e && f <= s && m >= t && m <= r && d.push(n[p]), (u === 0 ? e <= f : t <= m) && (i.push(h), i.push(p - 1), i.push(1 - u)), (u === 0 ? s >= f : r >= m) && (i.push(p + 1), i.push(l), i.push(1 - u));
|
|
832
909
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
910
|
+
return d;
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* Search the index for items within a given radius.
|
|
914
|
+
* @param {number} qx
|
|
915
|
+
* @param {number} qy
|
|
916
|
+
* @param {number} r Query radius.
|
|
917
|
+
* @returns {number[]} An array of indices correponding to the found items.
|
|
918
|
+
*/
|
|
919
|
+
within(e, t, s) {
|
|
920
|
+
if (!this._finished)
|
|
921
|
+
throw new Error("Data not yet indexed - call index.finish().");
|
|
922
|
+
const { ids: r, coords: n, nodeSize: a } = this, c = [0, r.length - 1, 0], i = [], d = s * s;
|
|
923
|
+
for (; c.length; ) {
|
|
924
|
+
const u = c.pop() || 0, l = c.pop() || 0, h = c.pop() || 0;
|
|
925
|
+
if (l - h <= a) {
|
|
926
|
+
for (let g = h; g <= l; g++)
|
|
927
|
+
ye(n[2 * g], n[2 * g + 1], e, t) <= d && i.push(r[g]);
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
const p = h + l >> 1, f = n[2 * p], m = n[2 * p + 1];
|
|
931
|
+
ye(f, m, e, t) <= d && i.push(r[p]), (u === 0 ? e - s <= f : t - s <= m) && (c.push(h), c.push(p - 1), c.push(1 - u)), (u === 0 ? e + s >= f : t + s >= m) && (c.push(p + 1), c.push(l), c.push(1 - u));
|
|
840
932
|
}
|
|
841
|
-
|
|
933
|
+
return i;
|
|
842
934
|
}
|
|
843
935
|
}
|
|
844
|
-
function
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
o[e] = o[t], o[t] = n;
|
|
936
|
+
function ne(o, e, t, s, r, n) {
|
|
937
|
+
if (r - s <= t)
|
|
938
|
+
return;
|
|
939
|
+
const a = s + r >> 1;
|
|
940
|
+
Se(o, e, a, s, r, n), ne(o, e, t, s, a - 1, 1 - n), ne(o, e, t, a + 1, r, 1 - n);
|
|
850
941
|
}
|
|
851
|
-
function
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
if (h - f <= a) {
|
|
857
|
-
for (let g = f; g <= h; g++)
|
|
858
|
-
p = e[2 * g], u = e[2 * g + 1], p >= t && p <= s && u >= n && u <= r && i.push(o[g]);
|
|
859
|
-
continue;
|
|
942
|
+
function Se(o, e, t, s, r, n) {
|
|
943
|
+
for (; r > s; ) {
|
|
944
|
+
if (r - s > 600) {
|
|
945
|
+
const d = r - s + 1, u = t - s + 1, l = Math.log(d), h = 0.5 * Math.exp(2 * l / 3), p = 0.5 * Math.sqrt(l * h * (d - h) / d) * (u - d / 2 < 0 ? -1 : 1), f = Math.max(s, Math.floor(t - u * h / d + p)), m = Math.min(r, Math.floor(t + (d - u) * h / d + p));
|
|
946
|
+
Se(o, e, t, f, m, n);
|
|
860
947
|
}
|
|
861
|
-
const
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
function Ke(o, e, t, n, s, r) {
|
|
869
|
-
const a = [0, o.length - 1, 0], l = [], i = s * s;
|
|
870
|
-
for (; a.length; ) {
|
|
871
|
-
const p = a.pop(), u = a.pop(), c = a.pop();
|
|
872
|
-
if (u - c <= r) {
|
|
873
|
-
for (let g = c; g <= u; g++)
|
|
874
|
-
ue(e[2 * g], e[2 * g + 1], t, n) <= i && l.push(o[g]);
|
|
875
|
-
continue;
|
|
948
|
+
const a = e[2 * t + n];
|
|
949
|
+
let c = s, i = r;
|
|
950
|
+
for (U(o, e, s, t), e[2 * r + n] > a && U(o, e, s, r); c < i; ) {
|
|
951
|
+
for (U(o, e, c, i), c++, i--; e[2 * c + n] < a; )
|
|
952
|
+
c++;
|
|
953
|
+
for (; e[2 * i + n] > a; )
|
|
954
|
+
i--;
|
|
876
955
|
}
|
|
877
|
-
|
|
878
|
-
ue(f, d, t, n) <= i && l.push(o[h]);
|
|
879
|
-
const m = (p + 1) % 2;
|
|
880
|
-
(p === 0 ? t - s <= f : n - s <= d) && (a.push(c), a.push(h - 1), a.push(m)), (p === 0 ? t + s >= f : n + s >= d) && (a.push(h + 1), a.push(u), a.push(m));
|
|
956
|
+
e[2 * s + n] === a ? U(o, e, s, i) : (i++, U(o, e, i, r)), i <= t && (s = i + 1), t <= i && (r = i - 1);
|
|
881
957
|
}
|
|
882
|
-
return l;
|
|
883
958
|
}
|
|
884
|
-
function
|
|
885
|
-
|
|
886
|
-
return s * s + r * r;
|
|
959
|
+
function U(o, e, t, s) {
|
|
960
|
+
re(o, t, s), re(e, 2 * t, 2 * s), re(e, 2 * t + 1, 2 * s + 1);
|
|
887
961
|
}
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
this.nodeSize = s, this.points = e;
|
|
892
|
-
const a = e.length < 65536 ? Uint16Array : Uint32Array, l = this.ids = new a(e.length), i = this.coords = new r(e.length * 2);
|
|
893
|
-
for (let p = 0; p < e.length; p++)
|
|
894
|
-
l[p] = p, i[2 * p] = t(e[p]), i[2 * p + 1] = n(e[p]);
|
|
895
|
-
J(l, i, s, 0, l.length - 1, 0);
|
|
896
|
-
}
|
|
897
|
-
range(e, t, n, s) {
|
|
898
|
-
return He(this.ids, this.coords, e, t, n, s, this.nodeSize);
|
|
899
|
-
}
|
|
900
|
-
within(e, t, n) {
|
|
901
|
-
return Ke(this.ids, this.coords, e, t, n, this.nodeSize);
|
|
902
|
-
}
|
|
962
|
+
function re(o, e, t) {
|
|
963
|
+
const s = o[e];
|
|
964
|
+
o[e] = o[t], o[t] = s;
|
|
903
965
|
}
|
|
904
|
-
|
|
966
|
+
function ye(o, e, t, s) {
|
|
967
|
+
const r = o - t, n = e - s;
|
|
968
|
+
return r * r + n * n;
|
|
969
|
+
}
|
|
970
|
+
const rt = {
|
|
905
971
|
minZoom: 0,
|
|
906
972
|
// min zoom to generate clusters on
|
|
907
973
|
maxZoom: 16,
|
|
@@ -924,168 +990,201 @@ const Je = {
|
|
|
924
990
|
// properties to use for individual points when running the reducer
|
|
925
991
|
map: (o) => o
|
|
926
992
|
// props => ({sum: props.my_value})
|
|
927
|
-
},
|
|
928
|
-
class
|
|
993
|
+
}, we = Math.fround || ((o) => (e) => (o[0] = +e, o[0]))(new Float32Array(1)), L = 2, x = 3, oe = 4, P = 5, Ae = 6;
|
|
994
|
+
class Te {
|
|
929
995
|
constructor(e) {
|
|
930
|
-
this.options =
|
|
996
|
+
this.options = Object.assign(Object.create(rt), e), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
|
|
931
997
|
}
|
|
932
998
|
load(e) {
|
|
933
|
-
const { log: t, minZoom:
|
|
999
|
+
const { log: t, minZoom: s, maxZoom: r } = this.options;
|
|
934
1000
|
t && console.time("total time");
|
|
935
|
-
const
|
|
936
|
-
t && console.time(
|
|
937
|
-
|
|
938
|
-
for (let i = 0; i < e.length; i++)
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
const
|
|
943
|
-
|
|
1001
|
+
const n = `prepare ${e.length} points`;
|
|
1002
|
+
t && console.time(n), this.points = e;
|
|
1003
|
+
const a = [];
|
|
1004
|
+
for (let i = 0; i < e.length; i++) {
|
|
1005
|
+
const d = e[i];
|
|
1006
|
+
if (!d.geometry)
|
|
1007
|
+
continue;
|
|
1008
|
+
const [u, l] = d.geometry.coordinates, h = we(H(u)), p = we(W(l));
|
|
1009
|
+
a.push(
|
|
1010
|
+
h,
|
|
1011
|
+
p,
|
|
1012
|
+
// projected point coordinates
|
|
1013
|
+
1 / 0,
|
|
1014
|
+
// the last zoom the point was processed at
|
|
1015
|
+
i,
|
|
1016
|
+
// index of the source feature in the original input array
|
|
1017
|
+
-1,
|
|
1018
|
+
// parent cluster id
|
|
1019
|
+
1
|
|
1020
|
+
// number of points in a cluster
|
|
1021
|
+
), this.options.reduce && a.push(0);
|
|
1022
|
+
}
|
|
1023
|
+
let c = this.trees[r + 1] = this._createTree(a);
|
|
1024
|
+
t && console.timeEnd(n);
|
|
1025
|
+
for (let i = r; i >= s; i--) {
|
|
1026
|
+
const d = +Date.now();
|
|
1027
|
+
c = this.trees[i] = this._createTree(this._cluster(c, i)), t && console.log("z%d: %d clusters in %dms", i, c.numItems, +Date.now() - d);
|
|
944
1028
|
}
|
|
945
1029
|
return t && console.timeEnd("total time"), this;
|
|
946
1030
|
}
|
|
947
1031
|
getClusters(e, t) {
|
|
948
|
-
let
|
|
949
|
-
const
|
|
950
|
-
let
|
|
1032
|
+
let s = ((e[0] + 180) % 360 + 360) % 360 - 180;
|
|
1033
|
+
const r = Math.max(-90, Math.min(90, e[1]));
|
|
1034
|
+
let n = e[2] === 180 ? 180 : ((e[2] + 180) % 360 + 360) % 360 - 180;
|
|
951
1035
|
const a = Math.max(-90, Math.min(90, e[3]));
|
|
952
1036
|
if (e[2] - e[0] >= 360)
|
|
953
|
-
|
|
954
|
-
else if (
|
|
955
|
-
const
|
|
956
|
-
return
|
|
1037
|
+
s = -180, n = 180;
|
|
1038
|
+
else if (s > n) {
|
|
1039
|
+
const l = this.getClusters([s, r, 180, a], t), h = this.getClusters([-180, r, n, a], t);
|
|
1040
|
+
return l.concat(h);
|
|
957
1041
|
}
|
|
958
|
-
const
|
|
959
|
-
for (const
|
|
960
|
-
const
|
|
961
|
-
|
|
1042
|
+
const c = this.trees[this._limitZoom(t)], i = c.range(H(s), W(a), H(n), W(r)), d = c.data, u = [];
|
|
1043
|
+
for (const l of i) {
|
|
1044
|
+
const h = this.stride * l;
|
|
1045
|
+
u.push(d[h + P] > 1 ? ke(d, h, this.clusterProps) : this.points[d[h + x]]);
|
|
962
1046
|
}
|
|
963
|
-
return
|
|
1047
|
+
return u;
|
|
964
1048
|
}
|
|
965
1049
|
getChildren(e) {
|
|
966
|
-
const t = this._getOriginId(e),
|
|
967
|
-
if (!
|
|
968
|
-
throw new Error(
|
|
969
|
-
const a =
|
|
970
|
-
if (
|
|
971
|
-
throw new Error(
|
|
972
|
-
const
|
|
973
|
-
for (const
|
|
974
|
-
const
|
|
975
|
-
|
|
1050
|
+
const t = this._getOriginId(e), s = this._getOriginZoom(e), r = "No cluster with the specified id.", n = this.trees[s];
|
|
1051
|
+
if (!n)
|
|
1052
|
+
throw new Error(r);
|
|
1053
|
+
const a = n.data;
|
|
1054
|
+
if (t * this.stride >= a.length)
|
|
1055
|
+
throw new Error(r);
|
|
1056
|
+
const c = this.options.radius / (this.options.extent * Math.pow(2, s - 1)), i = a[t * this.stride], d = a[t * this.stride + 1], u = n.within(i, d, c), l = [];
|
|
1057
|
+
for (const h of u) {
|
|
1058
|
+
const p = h * this.stride;
|
|
1059
|
+
a[p + oe] === e && l.push(a[p + P] > 1 ? ke(a, p, this.clusterProps) : this.points[a[p + x]]);
|
|
976
1060
|
}
|
|
977
|
-
if (
|
|
978
|
-
throw new Error(
|
|
979
|
-
return
|
|
1061
|
+
if (l.length === 0)
|
|
1062
|
+
throw new Error(r);
|
|
1063
|
+
return l;
|
|
980
1064
|
}
|
|
981
|
-
getLeaves(e, t,
|
|
982
|
-
t = t || 10,
|
|
983
|
-
const
|
|
984
|
-
return this._appendLeaves(
|
|
1065
|
+
getLeaves(e, t, s) {
|
|
1066
|
+
t = t || 10, s = s || 0;
|
|
1067
|
+
const r = [];
|
|
1068
|
+
return this._appendLeaves(r, e, t, s, 0), r;
|
|
985
1069
|
}
|
|
986
|
-
getTile(e, t,
|
|
987
|
-
const
|
|
1070
|
+
getTile(e, t, s) {
|
|
1071
|
+
const r = this.trees[this._limitZoom(e)], n = Math.pow(2, e), { extent: a, radius: c } = this.options, i = c / a, d = (s - i) / n, u = (s + 1 + i) / n, l = {
|
|
988
1072
|
features: []
|
|
989
1073
|
};
|
|
990
1074
|
return this._addTileFeatures(
|
|
991
|
-
|
|
992
|
-
|
|
1075
|
+
r.range((t - i) / n, d, (t + 1 + i) / n, u),
|
|
1076
|
+
r.data,
|
|
993
1077
|
t,
|
|
1078
|
+
s,
|
|
994
1079
|
n,
|
|
995
|
-
|
|
996
|
-
c
|
|
1080
|
+
l
|
|
997
1081
|
), t === 0 && this._addTileFeatures(
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
r,
|
|
1082
|
+
r.range(1 - i / n, d, 1, u),
|
|
1083
|
+
r.data,
|
|
1001
1084
|
n,
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1085
|
+
s,
|
|
1086
|
+
n,
|
|
1087
|
+
l
|
|
1088
|
+
), t === n - 1 && this._addTileFeatures(
|
|
1089
|
+
r.range(0, d, i / n, u),
|
|
1090
|
+
r.data,
|
|
1007
1091
|
-1,
|
|
1092
|
+
s,
|
|
1008
1093
|
n,
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
), c.features.length ? c : null;
|
|
1094
|
+
l
|
|
1095
|
+
), l.features.length ? l : null;
|
|
1012
1096
|
}
|
|
1013
1097
|
getClusterExpansionZoom(e) {
|
|
1014
1098
|
let t = this._getOriginZoom(e) - 1;
|
|
1015
1099
|
for (; t <= this.options.maxZoom; ) {
|
|
1016
|
-
const
|
|
1017
|
-
if (t++,
|
|
1100
|
+
const s = this.getChildren(e);
|
|
1101
|
+
if (t++, s.length !== 1)
|
|
1018
1102
|
break;
|
|
1019
|
-
e =
|
|
1103
|
+
e = s[0].properties.cluster_id;
|
|
1020
1104
|
}
|
|
1021
1105
|
return t;
|
|
1022
1106
|
}
|
|
1023
|
-
_appendLeaves(e, t,
|
|
1107
|
+
_appendLeaves(e, t, s, r, n) {
|
|
1024
1108
|
const a = this.getChildren(t);
|
|
1025
|
-
for (const
|
|
1026
|
-
const i =
|
|
1027
|
-
if (i && i.cluster ?
|
|
1109
|
+
for (const c of a) {
|
|
1110
|
+
const i = c.properties;
|
|
1111
|
+
if (i && i.cluster ? n + i.point_count <= r ? n += i.point_count : n = this._appendLeaves(e, i.cluster_id, s, r, n) : n < r ? n++ : e.push(c), e.length === s)
|
|
1028
1112
|
break;
|
|
1029
1113
|
}
|
|
1030
|
-
return
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1114
|
+
return n;
|
|
1115
|
+
}
|
|
1116
|
+
_createTree(e) {
|
|
1117
|
+
const t = new ae(e.length / this.stride | 0, this.options.nodeSize, Float32Array);
|
|
1118
|
+
for (let s = 0; s < e.length; s += this.stride)
|
|
1119
|
+
t.add(e[s], e[s + 1]);
|
|
1120
|
+
return t.finish(), t.data = e, t;
|
|
1121
|
+
}
|
|
1122
|
+
_addTileFeatures(e, t, s, r, n, a) {
|
|
1123
|
+
for (const c of e) {
|
|
1124
|
+
const i = c * this.stride, d = t[i + P] > 1;
|
|
1125
|
+
let u, l, h;
|
|
1126
|
+
if (d)
|
|
1127
|
+
u = Ie(t, i, this.clusterProps), l = t[i], h = t[i + 1];
|
|
1038
1128
|
else {
|
|
1039
|
-
const m = this.points[i
|
|
1040
|
-
u = m.properties
|
|
1129
|
+
const m = this.points[t[i + x]];
|
|
1130
|
+
u = m.properties;
|
|
1131
|
+
const [g, y] = m.geometry.coordinates;
|
|
1132
|
+
l = H(g), h = W(y);
|
|
1041
1133
|
}
|
|
1042
|
-
const
|
|
1134
|
+
const p = {
|
|
1043
1135
|
type: 1,
|
|
1044
1136
|
geometry: [[
|
|
1045
|
-
Math.round(this.options.extent * (
|
|
1046
|
-
Math.round(this.options.extent * (h *
|
|
1137
|
+
Math.round(this.options.extent * (l * n - s)),
|
|
1138
|
+
Math.round(this.options.extent * (h * n - r))
|
|
1047
1139
|
]],
|
|
1048
1140
|
tags: u
|
|
1049
1141
|
};
|
|
1050
|
-
let
|
|
1051
|
-
|
|
1142
|
+
let f;
|
|
1143
|
+
d || this.options.generateId ? f = t[i + x] : f = this.points[t[i + x]].id, f !== void 0 && (p.id = f), a.features.push(p);
|
|
1052
1144
|
}
|
|
1053
1145
|
}
|
|
1054
1146
|
_limitZoom(e) {
|
|
1055
1147
|
return Math.max(this.options.minZoom, Math.min(Math.floor(+e), this.options.maxZoom + 1));
|
|
1056
1148
|
}
|
|
1057
1149
|
_cluster(e, t) {
|
|
1058
|
-
const
|
|
1059
|
-
for (let
|
|
1060
|
-
|
|
1061
|
-
if (u.zoom <= t)
|
|
1150
|
+
const { radius: s, extent: r, reduce: n, minPoints: a } = this.options, c = s / (r * Math.pow(2, t)), i = e.data, d = [], u = this.stride;
|
|
1151
|
+
for (let l = 0; l < i.length; l += u) {
|
|
1152
|
+
if (i[l + L] <= t)
|
|
1062
1153
|
continue;
|
|
1063
|
-
|
|
1064
|
-
const
|
|
1065
|
-
let
|
|
1066
|
-
for (const
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1154
|
+
i[l + L] = t;
|
|
1155
|
+
const h = i[l], p = i[l + 1], f = e.within(i[l], i[l + 1], c), m = i[l + P];
|
|
1156
|
+
let g = m;
|
|
1157
|
+
for (const y of f) {
|
|
1158
|
+
const w = y * u;
|
|
1159
|
+
i[w + L] > t && (g += i[w + P]);
|
|
1069
1160
|
}
|
|
1070
|
-
if (
|
|
1071
|
-
let
|
|
1072
|
-
const
|
|
1073
|
-
for (const
|
|
1074
|
-
const
|
|
1075
|
-
if (
|
|
1161
|
+
if (g > m && g >= a) {
|
|
1162
|
+
let y = h * m, w = p * m, C, T = -1;
|
|
1163
|
+
const N = ((l / u | 0) << 5) + (t + 1) + this.points.length;
|
|
1164
|
+
for (const G of f) {
|
|
1165
|
+
const b = G * u;
|
|
1166
|
+
if (i[b + L] <= t)
|
|
1076
1167
|
continue;
|
|
1077
|
-
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1080
|
-
}
|
|
1081
|
-
u.parentId = w, n.push(Ye(m / d, g / d, w, d, C));
|
|
1082
|
-
} else if (n.push(u), d > 1)
|
|
1083
|
-
for (const m of h) {
|
|
1084
|
-
const g = c.points[m];
|
|
1085
|
-
g.zoom <= t || (g.zoom = t, n.push(g));
|
|
1168
|
+
i[b + L] = t;
|
|
1169
|
+
const F = i[b + P];
|
|
1170
|
+
y += i[b] * F, w += i[b + 1] * F, i[b + oe] = N, n && (C || (C = this._map(i, l, !0), T = this.clusterProps.length, this.clusterProps.push(C)), n(C, this._map(i, b)));
|
|
1086
1171
|
}
|
|
1172
|
+
i[l + oe] = N, d.push(y / g, w / g, 1 / 0, N, -1, g), n && d.push(T);
|
|
1173
|
+
} else {
|
|
1174
|
+
for (let y = 0; y < u; y++)
|
|
1175
|
+
d.push(i[l + y]);
|
|
1176
|
+
if (g > 1)
|
|
1177
|
+
for (const y of f) {
|
|
1178
|
+
const w = y * u;
|
|
1179
|
+
if (!(i[w + L] <= t)) {
|
|
1180
|
+
i[w + L] = t;
|
|
1181
|
+
for (let C = 0; C < u; C++)
|
|
1182
|
+
d.push(i[w + C]);
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1087
1186
|
}
|
|
1088
|
-
return
|
|
1187
|
+
return d;
|
|
1089
1188
|
}
|
|
1090
1189
|
// get index of the point from which the cluster originated
|
|
1091
1190
|
_getOriginId(e) {
|
|
@@ -1095,87 +1194,49 @@ class Xe {
|
|
|
1095
1194
|
_getOriginZoom(e) {
|
|
1096
1195
|
return (e - this.points.length) % 32;
|
|
1097
1196
|
}
|
|
1098
|
-
_map(e, t) {
|
|
1099
|
-
if (e
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1197
|
+
_map(e, t, s) {
|
|
1198
|
+
if (e[t + P] > 1) {
|
|
1199
|
+
const a = this.clusterProps[e[t + Ae]];
|
|
1200
|
+
return s ? Object.assign({}, a) : a;
|
|
1201
|
+
}
|
|
1202
|
+
const r = this.points[e[t + x]].properties, n = this.options.map(r);
|
|
1203
|
+
return s && n === r ? Object.assign({}, n) : n;
|
|
1103
1204
|
}
|
|
1104
1205
|
}
|
|
1105
|
-
function
|
|
1106
|
-
return {
|
|
1107
|
-
x: D(o),
|
|
1108
|
-
// weighted cluster center; round for consistency with Float32Array index
|
|
1109
|
-
y: D(e),
|
|
1110
|
-
zoom: 1 / 0,
|
|
1111
|
-
// the last zoom the cluster was processed at
|
|
1112
|
-
id: t,
|
|
1113
|
-
// encodes index of the first child of the cluster and its zoom level
|
|
1114
|
-
parentId: -1,
|
|
1115
|
-
// parent cluster id
|
|
1116
|
-
numPoints: n,
|
|
1117
|
-
properties: s
|
|
1118
|
-
};
|
|
1119
|
-
}
|
|
1120
|
-
function Qe(o, e) {
|
|
1121
|
-
const [t, n] = o.geometry.coordinates;
|
|
1122
|
-
return {
|
|
1123
|
-
x: D(B(t)),
|
|
1124
|
-
// projected point coordinates
|
|
1125
|
-
y: D(N(n)),
|
|
1126
|
-
zoom: 1 / 0,
|
|
1127
|
-
// the last zoom the point was processed at
|
|
1128
|
-
index: e,
|
|
1129
|
-
// index of the source feature in the original input array,
|
|
1130
|
-
parentId: -1
|
|
1131
|
-
// parent cluster id
|
|
1132
|
-
};
|
|
1133
|
-
}
|
|
1134
|
-
function de(o) {
|
|
1206
|
+
function ke(o, e, t) {
|
|
1135
1207
|
return {
|
|
1136
1208
|
type: "Feature",
|
|
1137
|
-
id: o
|
|
1138
|
-
properties:
|
|
1209
|
+
id: o[e + x],
|
|
1210
|
+
properties: Ie(o, e, t),
|
|
1139
1211
|
geometry: {
|
|
1140
1212
|
type: "Point",
|
|
1141
|
-
coordinates: [
|
|
1213
|
+
coordinates: [ot(o[e]), nt(o[e + 1])]
|
|
1142
1214
|
}
|
|
1143
1215
|
};
|
|
1144
1216
|
}
|
|
1145
|
-
function
|
|
1146
|
-
const
|
|
1147
|
-
return
|
|
1217
|
+
function Ie(o, e, t) {
|
|
1218
|
+
const s = o[e + P], r = s >= 1e4 ? `${Math.round(s / 1e3)}k` : s >= 1e3 ? `${Math.round(s / 100) / 10}k` : s, n = o[e + Ae], a = n === -1 ? {} : Object.assign({}, t[n]);
|
|
1219
|
+
return Object.assign(a, {
|
|
1148
1220
|
cluster: !0,
|
|
1149
|
-
cluster_id: o
|
|
1150
|
-
point_count:
|
|
1151
|
-
point_count_abbreviated:
|
|
1221
|
+
cluster_id: o[e + x],
|
|
1222
|
+
point_count: s,
|
|
1223
|
+
point_count_abbreviated: r
|
|
1152
1224
|
});
|
|
1153
1225
|
}
|
|
1154
|
-
function
|
|
1226
|
+
function H(o) {
|
|
1155
1227
|
return o / 360 + 0.5;
|
|
1156
1228
|
}
|
|
1157
|
-
function
|
|
1229
|
+
function W(o) {
|
|
1158
1230
|
const e = Math.sin(o * Math.PI / 180), t = 0.5 - 0.25 * Math.log((1 + e) / (1 - e)) / Math.PI;
|
|
1159
1231
|
return t < 0 ? 0 : t > 1 ? 1 : t;
|
|
1160
1232
|
}
|
|
1161
|
-
function
|
|
1233
|
+
function ot(o) {
|
|
1162
1234
|
return (o - 0.5) * 360;
|
|
1163
1235
|
}
|
|
1164
|
-
function
|
|
1236
|
+
function nt(o) {
|
|
1165
1237
|
const e = (180 - o * 360) * Math.PI / 180;
|
|
1166
1238
|
return 360 * Math.atan(Math.exp(e)) / Math.PI - 90;
|
|
1167
1239
|
}
|
|
1168
|
-
function R(o, e) {
|
|
1169
|
-
for (const t in e)
|
|
1170
|
-
o[t] = e[t];
|
|
1171
|
-
return o;
|
|
1172
|
-
}
|
|
1173
|
-
function he(o) {
|
|
1174
|
-
return o.x;
|
|
1175
|
-
}
|
|
1176
|
-
function fe(o) {
|
|
1177
|
-
return o.y;
|
|
1178
|
-
}
|
|
1179
1240
|
/*! *****************************************************************************
|
|
1180
1241
|
Copyright (c) Microsoft Corporation.
|
|
1181
1242
|
|
|
@@ -1190,22 +1251,52 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
1190
1251
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1191
1252
|
PERFORMANCE OF THIS SOFTWARE.
|
|
1192
1253
|
***************************************************************************** */
|
|
1193
|
-
function
|
|
1254
|
+
function le(o, e) {
|
|
1194
1255
|
var t = {};
|
|
1195
|
-
for (var
|
|
1196
|
-
Object.prototype.hasOwnProperty.call(o,
|
|
1256
|
+
for (var s in o)
|
|
1257
|
+
Object.prototype.hasOwnProperty.call(o, s) && e.indexOf(s) < 0 && (t[s] = o[s]);
|
|
1197
1258
|
if (o != null && typeof Object.getOwnPropertySymbols == "function")
|
|
1198
|
-
for (var
|
|
1199
|
-
e.indexOf(
|
|
1259
|
+
for (var r = 0, s = Object.getOwnPropertySymbols(o); r < s.length; r++)
|
|
1260
|
+
e.indexOf(s[r]) < 0 && Object.prototype.propertyIsEnumerable.call(o, s[r]) && (t[s[r]] = o[s[r]]);
|
|
1200
1261
|
return t;
|
|
1201
1262
|
}
|
|
1202
|
-
class
|
|
1263
|
+
class k {
|
|
1264
|
+
static isAdvancedMarkerAvailable(e) {
|
|
1265
|
+
return google.maps.marker && e.getMapCapabilities().isAdvancedMarkersAvailable === !0;
|
|
1266
|
+
}
|
|
1267
|
+
static isAdvancedMarker(e) {
|
|
1268
|
+
return google.maps.marker && e instanceof google.maps.marker.AdvancedMarkerElement;
|
|
1269
|
+
}
|
|
1270
|
+
static setMap(e, t) {
|
|
1271
|
+
this.isAdvancedMarker(e) ? e.map = t : e.setMap(t);
|
|
1272
|
+
}
|
|
1273
|
+
static getPosition(e) {
|
|
1274
|
+
if (this.isAdvancedMarker(e)) {
|
|
1275
|
+
if (e.position) {
|
|
1276
|
+
if (e.position instanceof google.maps.LatLng)
|
|
1277
|
+
return e.position;
|
|
1278
|
+
if (e.position.lat && e.position.lng)
|
|
1279
|
+
return new google.maps.LatLng(e.position.lat, e.position.lng);
|
|
1280
|
+
}
|
|
1281
|
+
return new google.maps.LatLng(null);
|
|
1282
|
+
}
|
|
1283
|
+
return e.getPosition();
|
|
1284
|
+
}
|
|
1285
|
+
static getVisible(e) {
|
|
1286
|
+
return this.isAdvancedMarker(e) ? !0 : e.getVisible();
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
class V {
|
|
1203
1290
|
constructor({ markers: e, position: t }) {
|
|
1204
1291
|
this.markers = e, t && (t instanceof google.maps.LatLng ? this._position = t : this._position = new google.maps.LatLng(t));
|
|
1205
1292
|
}
|
|
1206
1293
|
get bounds() {
|
|
1207
|
-
if (
|
|
1208
|
-
return
|
|
1294
|
+
if (this.markers.length === 0 && !this._position)
|
|
1295
|
+
return;
|
|
1296
|
+
const e = new google.maps.LatLngBounds(this._position, this._position);
|
|
1297
|
+
for (const t of this.markers)
|
|
1298
|
+
e.extend(k.getPosition(t));
|
|
1299
|
+
return e;
|
|
1209
1300
|
}
|
|
1210
1301
|
get position() {
|
|
1211
1302
|
return this._position || this.bounds.getCenter();
|
|
@@ -1214,7 +1305,7 @@ class X {
|
|
|
1214
1305
|
* Get the count of **visible** markers.
|
|
1215
1306
|
*/
|
|
1216
1307
|
get count() {
|
|
1217
|
-
return this.markers.filter((e) =>
|
|
1308
|
+
return this.markers.filter((e) => k.getVisible(e)).length;
|
|
1218
1309
|
}
|
|
1219
1310
|
/**
|
|
1220
1311
|
* Add a marker to the cluster.
|
|
@@ -1226,10 +1317,26 @@ class X {
|
|
|
1226
1317
|
* Cleanup references and remove marker from map.
|
|
1227
1318
|
*/
|
|
1228
1319
|
delete() {
|
|
1229
|
-
this.marker && (this.marker
|
|
1320
|
+
this.marker && (k.setMap(this.marker, null), this.marker = void 0), this.markers.length = 0;
|
|
1230
1321
|
}
|
|
1231
1322
|
}
|
|
1232
|
-
|
|
1323
|
+
const it = (o, e, t, s) => {
|
|
1324
|
+
const r = $e(o.getBounds(), e, s);
|
|
1325
|
+
return t.filter((n) => r.contains(k.getPosition(n)));
|
|
1326
|
+
}, $e = (o, e, t) => {
|
|
1327
|
+
const { northEast: s, southWest: r } = at(o, e), n = lt({ northEast: s, southWest: r }, t);
|
|
1328
|
+
return ct(n, e);
|
|
1329
|
+
}, _e = (o, e, t) => {
|
|
1330
|
+
const s = $e(o, e, t), r = s.getNorthEast(), n = s.getSouthWest();
|
|
1331
|
+
return [n.lng(), n.lat(), r.lng(), r.lat()];
|
|
1332
|
+
}, at = (o, e) => ({
|
|
1333
|
+
northEast: e.fromLatLngToDivPixel(o.getNorthEast()),
|
|
1334
|
+
southWest: e.fromLatLngToDivPixel(o.getSouthWest())
|
|
1335
|
+
}), lt = ({ northEast: o, southWest: e }, t) => (o.x += t, o.y -= t, e.x -= t, e.y += t, { northEast: o, southWest: e }), ct = ({ northEast: o, southWest: e }, t) => {
|
|
1336
|
+
const s = t.fromDivPixelToLatLng(e), r = t.fromDivPixelToLatLng(o);
|
|
1337
|
+
return new google.maps.LatLngBounds(s, r);
|
|
1338
|
+
};
|
|
1339
|
+
class je {
|
|
1233
1340
|
constructor({ maxZoom: e = 16 }) {
|
|
1234
1341
|
this.maxZoom = e;
|
|
1235
1342
|
}
|
|
@@ -1240,78 +1347,144 @@ class nt {
|
|
|
1240
1347
|
* ```typescript
|
|
1241
1348
|
* cluster({markers, map}: AlgorithmInput): Cluster[] {
|
|
1242
1349
|
* if (shouldBypassClustering(map)) {
|
|
1243
|
-
* return this.noop({markers
|
|
1350
|
+
* return this.noop({markers})
|
|
1244
1351
|
* }
|
|
1245
1352
|
* }
|
|
1246
1353
|
* ```
|
|
1247
1354
|
*/
|
|
1248
1355
|
noop({ markers: e }) {
|
|
1249
|
-
return
|
|
1356
|
+
return dt(e);
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
class ut extends je {
|
|
1360
|
+
constructor(e) {
|
|
1361
|
+
var { viewportPadding: t = 60 } = e, s = le(e, ["viewportPadding"]);
|
|
1362
|
+
super(s), this.viewportPadding = 60, this.viewportPadding = t;
|
|
1363
|
+
}
|
|
1364
|
+
calculate({ markers: e, map: t, mapCanvasProjection: s }) {
|
|
1365
|
+
return t.getZoom() >= this.maxZoom ? {
|
|
1366
|
+
clusters: this.noop({
|
|
1367
|
+
markers: e
|
|
1368
|
+
}),
|
|
1369
|
+
changed: !1
|
|
1370
|
+
} : {
|
|
1371
|
+
clusters: this.cluster({
|
|
1372
|
+
markers: it(t, s, e, this.viewportPadding),
|
|
1373
|
+
map: t,
|
|
1374
|
+
mapCanvasProjection: s
|
|
1375
|
+
})
|
|
1376
|
+
};
|
|
1250
1377
|
}
|
|
1251
1378
|
}
|
|
1252
|
-
const
|
|
1253
|
-
position:
|
|
1379
|
+
const dt = (o) => o.map((t) => new V({
|
|
1380
|
+
position: k.getPosition(t),
|
|
1254
1381
|
markers: [t]
|
|
1255
1382
|
}));
|
|
1256
|
-
class
|
|
1383
|
+
class ht extends je {
|
|
1257
1384
|
constructor(e) {
|
|
1258
|
-
var { maxZoom: t, radius:
|
|
1259
|
-
super({ maxZoom: t }), this.superCluster = new
|
|
1385
|
+
var { maxZoom: t, radius: s = 60 } = e, r = le(e, ["maxZoom", "radius"]);
|
|
1386
|
+
super({ maxZoom: t }), this.state = { zoom: -1 }, this.superCluster = new Te(Object.assign({ maxZoom: this.maxZoom, radius: s }, r));
|
|
1260
1387
|
}
|
|
1261
1388
|
calculate(e) {
|
|
1262
1389
|
let t = !1;
|
|
1390
|
+
const s = { zoom: e.map.getZoom() };
|
|
1263
1391
|
if (!A(e.markers, this.markers)) {
|
|
1264
1392
|
t = !0, this.markers = [...e.markers];
|
|
1265
|
-
const
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
type: "
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
})
|
|
1276
|
-
this.superCluster.load(
|
|
1393
|
+
const r = this.markers.map((n) => {
|
|
1394
|
+
const a = k.getPosition(n);
|
|
1395
|
+
return {
|
|
1396
|
+
type: "Feature",
|
|
1397
|
+
geometry: {
|
|
1398
|
+
type: "Point",
|
|
1399
|
+
coordinates: [a.lng(), a.lat()]
|
|
1400
|
+
},
|
|
1401
|
+
properties: { marker: n }
|
|
1402
|
+
};
|
|
1403
|
+
});
|
|
1404
|
+
this.superCluster.load(r);
|
|
1277
1405
|
}
|
|
1278
|
-
|
|
1279
|
-
return t || this.state.zoom > this.maxZoom && n.zoom > this.maxZoom || (t = t || !A(this.state, n)), this.state = n, t && (this.clusters = this.cluster(e)), { clusters: this.clusters, changed: t };
|
|
1406
|
+
return t || (this.state.zoom <= this.maxZoom || s.zoom <= this.maxZoom) && (t = !A(this.state, s)), this.state = s, t && (this.clusters = this.cluster(e)), { clusters: this.clusters, changed: t };
|
|
1280
1407
|
}
|
|
1281
1408
|
cluster({ map: e }) {
|
|
1282
|
-
return this.superCluster.getClusters([-180, -90, 180, 90], Math.round(e.getZoom())).map(this.transformCluster
|
|
1409
|
+
return this.superCluster.getClusters([-180, -90, 180, 90], Math.round(e.getZoom())).map((t) => this.transformCluster(t));
|
|
1283
1410
|
}
|
|
1284
|
-
transformCluster({ geometry: { coordinates: [e, t] }, properties:
|
|
1285
|
-
if (
|
|
1286
|
-
return new
|
|
1287
|
-
markers: this.superCluster.getLeaves(
|
|
1288
|
-
position:
|
|
1411
|
+
transformCluster({ geometry: { coordinates: [e, t] }, properties: s }) {
|
|
1412
|
+
if (s.cluster)
|
|
1413
|
+
return new V({
|
|
1414
|
+
markers: this.superCluster.getLeaves(s.cluster_id, 1 / 0).map((n) => n.properties.marker),
|
|
1415
|
+
position: { lat: t, lng: e }
|
|
1289
1416
|
});
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1417
|
+
const r = s.marker;
|
|
1418
|
+
return new V({
|
|
1419
|
+
markers: [r],
|
|
1420
|
+
position: k.getPosition(r)
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
class pt extends ut {
|
|
1425
|
+
constructor(e) {
|
|
1426
|
+
var { maxZoom: t, radius: s = 60, viewportPadding: r = 60 } = e, n = le(e, ["maxZoom", "radius", "viewportPadding"]);
|
|
1427
|
+
super({ maxZoom: t, viewportPadding: r }), this.superCluster = new Te(Object.assign({ maxZoom: this.maxZoom, radius: s }, n)), this.state = { zoom: -1, view: [0, 0, 0, 0] };
|
|
1428
|
+
}
|
|
1429
|
+
calculate(e) {
|
|
1430
|
+
const t = {
|
|
1431
|
+
zoom: Math.round(e.map.getZoom()),
|
|
1432
|
+
view: _e(e.map.getBounds(), e.mapCanvasProjection, this.viewportPadding)
|
|
1433
|
+
};
|
|
1434
|
+
let s = !A(this.state, t);
|
|
1435
|
+
if (!A(e.markers, this.markers)) {
|
|
1436
|
+
s = !0, this.markers = [...e.markers];
|
|
1437
|
+
const r = this.markers.map((n) => {
|
|
1438
|
+
const a = k.getPosition(n);
|
|
1439
|
+
return {
|
|
1440
|
+
type: "Feature",
|
|
1441
|
+
geometry: {
|
|
1442
|
+
type: "Point",
|
|
1443
|
+
coordinates: [a.lng(), a.lat()]
|
|
1444
|
+
},
|
|
1445
|
+
properties: { marker: n }
|
|
1446
|
+
};
|
|
1295
1447
|
});
|
|
1448
|
+
this.superCluster.load(r);
|
|
1296
1449
|
}
|
|
1450
|
+
return s && (this.clusters = this.cluster(e), this.state = t), { clusters: this.clusters, changed: s };
|
|
1451
|
+
}
|
|
1452
|
+
cluster({ map: e, mapCanvasProjection: t }) {
|
|
1453
|
+
const s = {
|
|
1454
|
+
zoom: Math.round(e.getZoom()),
|
|
1455
|
+
view: _e(e.getBounds(), t, this.viewportPadding)
|
|
1456
|
+
};
|
|
1457
|
+
return this.superCluster.getClusters(s.view, s.zoom).map((r) => this.transformCluster(r));
|
|
1458
|
+
}
|
|
1459
|
+
transformCluster({ geometry: { coordinates: [e, t] }, properties: s }) {
|
|
1460
|
+
if (s.cluster)
|
|
1461
|
+
return new V({
|
|
1462
|
+
markers: this.superCluster.getLeaves(s.cluster_id, 1 / 0).map((n) => n.properties.marker),
|
|
1463
|
+
position: { lat: t, lng: e }
|
|
1464
|
+
});
|
|
1465
|
+
const r = s.marker;
|
|
1466
|
+
return new V({
|
|
1467
|
+
markers: [r],
|
|
1468
|
+
position: k.getPosition(r)
|
|
1469
|
+
});
|
|
1297
1470
|
}
|
|
1298
1471
|
}
|
|
1299
|
-
class
|
|
1472
|
+
class ft {
|
|
1300
1473
|
constructor(e, t) {
|
|
1301
1474
|
this.markers = { sum: e.length };
|
|
1302
|
-
const
|
|
1475
|
+
const s = t.map((n) => n.count), r = s.reduce((n, a) => n + a, 0);
|
|
1303
1476
|
this.clusters = {
|
|
1304
1477
|
count: t.length,
|
|
1305
1478
|
markers: {
|
|
1306
|
-
mean:
|
|
1307
|
-
sum:
|
|
1308
|
-
min: Math.min(...
|
|
1309
|
-
max: Math.max(...
|
|
1479
|
+
mean: r / t.length,
|
|
1480
|
+
sum: r,
|
|
1481
|
+
min: Math.min(...s),
|
|
1482
|
+
max: Math.max(...s)
|
|
1310
1483
|
}
|
|
1311
1484
|
};
|
|
1312
1485
|
}
|
|
1313
1486
|
}
|
|
1314
|
-
class
|
|
1487
|
+
class mt {
|
|
1315
1488
|
/**
|
|
1316
1489
|
* The default render function for the library used by {@link MarkerClusterer}.
|
|
1317
1490
|
*
|
|
@@ -1350,67 +1523,76 @@ class at {
|
|
|
1350
1523
|
* });
|
|
1351
1524
|
* ```
|
|
1352
1525
|
*/
|
|
1353
|
-
render({ count: e, position: t },
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1526
|
+
render({ count: e, position: t }, s, r) {
|
|
1527
|
+
const a = `<svg fill="${e > Math.max(10, s.clusters.markers.mean) ? "#ff0000" : "#0000ff"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50" height="50">
|
|
1528
|
+
<circle cx="120" cy="120" opacity=".6" r="70" />
|
|
1529
|
+
<circle cx="120" cy="120" opacity=".3" r="90" />
|
|
1530
|
+
<circle cx="120" cy="120" opacity=".2" r="110" />
|
|
1531
|
+
<text x="50%" y="50%" style="fill:#fff" text-anchor="middle" font-size="50" dominant-baseline="middle" font-family="roboto,arial,sans-serif">${e}</text>
|
|
1532
|
+
</svg>`, c = `Cluster of ${e} markers`, i = Number(google.maps.Marker.MAX_ZINDEX) + e;
|
|
1533
|
+
if (k.isAdvancedMarkerAvailable(r)) {
|
|
1534
|
+
const u = document.createElement("div");
|
|
1535
|
+
u.innerHTML = a;
|
|
1536
|
+
const l = u.firstElementChild;
|
|
1537
|
+
l.setAttribute("transform", "translate(0 25)");
|
|
1538
|
+
const h = {
|
|
1539
|
+
map: r,
|
|
1540
|
+
position: t,
|
|
1541
|
+
zIndex: i,
|
|
1542
|
+
title: c,
|
|
1543
|
+
content: l
|
|
1544
|
+
};
|
|
1545
|
+
return new google.maps.marker.AdvancedMarkerElement(h);
|
|
1546
|
+
}
|
|
1547
|
+
const d = {
|
|
1361
1548
|
position: t,
|
|
1549
|
+
zIndex: i,
|
|
1550
|
+
title: c,
|
|
1362
1551
|
icon: {
|
|
1363
|
-
url: `data:image/svg+xml;base64,${
|
|
1364
|
-
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
color: "rgba(255,255,255,0.9)",
|
|
1369
|
-
fontSize: "12px"
|
|
1370
|
-
},
|
|
1371
|
-
title: `Cluster of ${e} markers`,
|
|
1372
|
-
// adjust zIndex to be above other markers
|
|
1373
|
-
zIndex: Number(google.maps.Marker.MAX_ZINDEX) + e
|
|
1374
|
-
});
|
|
1552
|
+
url: `data:image/svg+xml;base64,${btoa(a)}`,
|
|
1553
|
+
anchor: new google.maps.Point(25, 25)
|
|
1554
|
+
}
|
|
1555
|
+
};
|
|
1556
|
+
return new google.maps.Marker(d);
|
|
1375
1557
|
}
|
|
1376
1558
|
}
|
|
1377
|
-
function
|
|
1559
|
+
function gt(o, e) {
|
|
1378
1560
|
for (let t in e.prototype)
|
|
1379
1561
|
o.prototype[t] = e.prototype[t];
|
|
1380
1562
|
}
|
|
1381
|
-
class
|
|
1563
|
+
class ce {
|
|
1382
1564
|
constructor() {
|
|
1383
|
-
|
|
1565
|
+
gt(ce, google.maps.OverlayView);
|
|
1384
1566
|
}
|
|
1385
1567
|
}
|
|
1386
|
-
var
|
|
1568
|
+
var I;
|
|
1387
1569
|
(function(o) {
|
|
1388
1570
|
o.CLUSTERING_BEGIN = "clusteringbegin", o.CLUSTERING_END = "clusteringend", o.CLUSTER_CLICK = "click";
|
|
1389
|
-
})(
|
|
1390
|
-
const
|
|
1571
|
+
})(I || (I = {}));
|
|
1572
|
+
const vt = (o, e, t) => {
|
|
1391
1573
|
t.fitBounds(e.bounds);
|
|
1392
1574
|
};
|
|
1393
|
-
class
|
|
1394
|
-
constructor({ map: e, markers: t = [], algorithm:
|
|
1395
|
-
super(), this.markers = [...t], this.clusters = [], this.algorithm =
|
|
1575
|
+
class yt extends ce {
|
|
1576
|
+
constructor({ map: e, markers: t = [], algorithmOptions: s = {}, algorithm: r = new ht(s), renderer: n = new mt(), onClusterClick: a = vt }) {
|
|
1577
|
+
super(), this.markers = [...t], this.clusters = [], this.algorithm = r, this.renderer = n, this.onClusterClick = a, e && this.setMap(e);
|
|
1396
1578
|
}
|
|
1397
1579
|
addMarker(e, t) {
|
|
1398
1580
|
this.markers.includes(e) || (this.markers.push(e), t || this.render());
|
|
1399
1581
|
}
|
|
1400
1582
|
addMarkers(e, t) {
|
|
1401
|
-
e.forEach((
|
|
1402
|
-
this.addMarker(
|
|
1583
|
+
e.forEach((s) => {
|
|
1584
|
+
this.addMarker(s, !0);
|
|
1403
1585
|
}), t || this.render();
|
|
1404
1586
|
}
|
|
1405
1587
|
removeMarker(e, t) {
|
|
1406
|
-
const
|
|
1407
|
-
return
|
|
1588
|
+
const s = this.markers.indexOf(e);
|
|
1589
|
+
return s === -1 ? !1 : (k.setMap(e, null), this.markers.splice(s, 1), t || this.render(), !0);
|
|
1408
1590
|
}
|
|
1409
1591
|
removeMarkers(e, t) {
|
|
1410
|
-
let
|
|
1411
|
-
return e.forEach((
|
|
1412
|
-
|
|
1413
|
-
}),
|
|
1592
|
+
let s = !1;
|
|
1593
|
+
return e.forEach((r) => {
|
|
1594
|
+
s = this.removeMarker(r, !0) || s;
|
|
1595
|
+
}), s && !t && this.render(), s;
|
|
1414
1596
|
}
|
|
1415
1597
|
clearMarkers(e) {
|
|
1416
1598
|
this.markers.length = 0, e || this.render();
|
|
@@ -1420,14 +1602,23 @@ class ut extends Q {
|
|
|
1420
1602
|
*/
|
|
1421
1603
|
render() {
|
|
1422
1604
|
const e = this.getMap();
|
|
1423
|
-
if (e instanceof google.maps.Map &&
|
|
1424
|
-
google.maps.event.trigger(this,
|
|
1425
|
-
const { clusters: t, changed:
|
|
1605
|
+
if (e instanceof google.maps.Map && e.getProjection()) {
|
|
1606
|
+
google.maps.event.trigger(this, I.CLUSTERING_BEGIN, this);
|
|
1607
|
+
const { clusters: t, changed: s } = this.algorithm.calculate({
|
|
1426
1608
|
markers: this.markers,
|
|
1427
1609
|
map: e,
|
|
1428
1610
|
mapCanvasProjection: this.getProjection()
|
|
1429
1611
|
});
|
|
1430
|
-
(
|
|
1612
|
+
if (s || s == null) {
|
|
1613
|
+
const r = /* @__PURE__ */ new Set();
|
|
1614
|
+
for (const a of t)
|
|
1615
|
+
a.markers.length == 1 && r.add(a.markers[0]);
|
|
1616
|
+
const n = [];
|
|
1617
|
+
for (const a of this.clusters)
|
|
1618
|
+
a.marker != null && (a.markers.length == 1 ? r.has(a.marker) || k.setMap(a.marker, null) : n.push(a.marker));
|
|
1619
|
+
this.clusters = t, this.renderClusters(), requestAnimationFrame(() => n.forEach((a) => k.setMap(a, null)));
|
|
1620
|
+
}
|
|
1621
|
+
google.maps.event.trigger(this, I.CLUSTERING_END, this);
|
|
1431
1622
|
}
|
|
1432
1623
|
}
|
|
1433
1624
|
onAdd() {
|
|
@@ -1437,22 +1628,22 @@ class ut extends Q {
|
|
|
1437
1628
|
google.maps.event.removeListener(this.idleListener), this.reset();
|
|
1438
1629
|
}
|
|
1439
1630
|
reset() {
|
|
1440
|
-
this.markers.forEach((e) =>
|
|
1631
|
+
this.markers.forEach((e) => k.setMap(e, null)), this.clusters.forEach((e) => e.delete()), this.clusters = [];
|
|
1441
1632
|
}
|
|
1442
1633
|
renderClusters() {
|
|
1443
|
-
const e = new
|
|
1444
|
-
this.clusters.forEach((
|
|
1445
|
-
|
|
1634
|
+
const e = new ft(this.markers, this.clusters), t = this.getMap();
|
|
1635
|
+
this.clusters.forEach((s) => {
|
|
1636
|
+
s.markers.length === 1 ? s.marker = s.markers[0] : (s.marker = this.renderer.render(s, e, t), s.markers.forEach((r) => k.setMap(r, null)), this.onClusterClick && s.marker.addListener(
|
|
1446
1637
|
"click",
|
|
1447
1638
|
/* istanbul ignore next */
|
|
1448
|
-
(
|
|
1449
|
-
google.maps.event.trigger(this,
|
|
1639
|
+
(r) => {
|
|
1640
|
+
google.maps.event.trigger(this, I.CLUSTER_CLICK, s), this.onClusterClick(r, s, t);
|
|
1450
1641
|
}
|
|
1451
|
-
)),
|
|
1642
|
+
)), k.setMap(s.marker, t);
|
|
1452
1643
|
});
|
|
1453
1644
|
}
|
|
1454
1645
|
}
|
|
1455
|
-
const
|
|
1646
|
+
const Ce = Object.values(I), It = M({
|
|
1456
1647
|
name: "MarkerCluster",
|
|
1457
1648
|
props: {
|
|
1458
1649
|
options: {
|
|
@@ -1460,29 +1651,37 @@ const me = Object.values(x), Ot = k({
|
|
|
1460
1651
|
default: () => ({})
|
|
1461
1652
|
}
|
|
1462
1653
|
},
|
|
1463
|
-
emits:
|
|
1464
|
-
setup(o, { emit: e, expose: t, slots:
|
|
1465
|
-
const
|
|
1466
|
-
return
|
|
1467
|
-
|
|
1654
|
+
emits: Ce,
|
|
1655
|
+
setup(o, { emit: e, expose: t, slots: s }) {
|
|
1656
|
+
const r = v(), n = _(q, v()), a = _(R, v());
|
|
1657
|
+
return z(Ee, r), O(
|
|
1658
|
+
n,
|
|
1468
1659
|
() => {
|
|
1469
|
-
|
|
1660
|
+
n.value && (r.value = E(
|
|
1661
|
+
new yt({
|
|
1662
|
+
map: n.value,
|
|
1663
|
+
// Better perf than the default `SuperClusterAlgorithm`. See:
|
|
1664
|
+
// https://github.com/googlemaps/js-markerclusterer/pull/640
|
|
1665
|
+
algorithm: new pt(o.options.algorithmOptions ?? {}),
|
|
1666
|
+
...o.options
|
|
1667
|
+
})
|
|
1668
|
+
), Ce.forEach((c) => {
|
|
1470
1669
|
var i;
|
|
1471
|
-
(i =
|
|
1670
|
+
(i = r.value) == null || i.addListener(c, (d) => e(c, d));
|
|
1472
1671
|
}));
|
|
1473
1672
|
},
|
|
1474
1673
|
{
|
|
1475
1674
|
immediate: !0
|
|
1476
1675
|
}
|
|
1477
|
-
),
|
|
1478
|
-
var
|
|
1479
|
-
|
|
1480
|
-
}), t({ markerCluster:
|
|
1481
|
-
var
|
|
1482
|
-
return (
|
|
1676
|
+
), j(() => {
|
|
1677
|
+
var c;
|
|
1678
|
+
r.value && ((c = a.value) == null || c.event.clearInstanceListeners(r.value), r.value.clearMarkers(), r.value.setMap(null));
|
|
1679
|
+
}), t({ markerCluster: r }), () => {
|
|
1680
|
+
var c;
|
|
1681
|
+
return (c = s.default) == null ? void 0 : c.call(s);
|
|
1483
1682
|
};
|
|
1484
1683
|
}
|
|
1485
|
-
}),
|
|
1684
|
+
}), wt = M({
|
|
1486
1685
|
inheritAttrs: !1,
|
|
1487
1686
|
props: {
|
|
1488
1687
|
options: {
|
|
@@ -1490,34 +1689,34 @@ const me = Object.values(x), Ot = k({
|
|
|
1490
1689
|
required: !0
|
|
1491
1690
|
}
|
|
1492
1691
|
},
|
|
1493
|
-
setup(o, { slots: e, emit: t, expose:
|
|
1494
|
-
const
|
|
1692
|
+
setup(o, { slots: e, emit: t, expose: s }) {
|
|
1693
|
+
const r = v(), n = K(() => {
|
|
1495
1694
|
var i;
|
|
1496
|
-
return (i = e.default) == null ? void 0 : i.call(e).some((
|
|
1497
|
-
}), a =
|
|
1695
|
+
return (i = e.default) == null ? void 0 : i.call(e).some((d) => d.type !== be);
|
|
1696
|
+
}), a = K(() => ({
|
|
1498
1697
|
...o.options,
|
|
1499
|
-
element:
|
|
1500
|
-
})),
|
|
1501
|
-
return
|
|
1502
|
-
customMarker:
|
|
1503
|
-
}), { customMarkerRef:
|
|
1698
|
+
element: r.value
|
|
1699
|
+
})), c = Z(Q, [], a, t);
|
|
1700
|
+
return s({
|
|
1701
|
+
customMarker: c
|
|
1702
|
+
}), { customMarkerRef: r, customMarker: c, hasSlotContent: n };
|
|
1504
1703
|
}
|
|
1505
1704
|
});
|
|
1506
|
-
const
|
|
1705
|
+
const kt = {
|
|
1507
1706
|
key: 0,
|
|
1508
1707
|
class: "custom-marker-wrapper"
|
|
1509
1708
|
};
|
|
1510
|
-
function
|
|
1511
|
-
return o.hasSlotContent ? (
|
|
1512
|
-
|
|
1709
|
+
function _t(o, e, t, s, r, n) {
|
|
1710
|
+
return o.hasSlotContent ? (J(), Y("div", kt, [
|
|
1711
|
+
ie("div", Oe({
|
|
1513
1712
|
ref: "customMarkerRef",
|
|
1514
1713
|
style: { cursor: o.$attrs.onClick ? "pointer" : void 0 }
|
|
1515
1714
|
}, o.$attrs), [
|
|
1516
|
-
|
|
1715
|
+
X(o.$slots, "default", {}, void 0, !0)
|
|
1517
1716
|
], 16)
|
|
1518
|
-
])) :
|
|
1717
|
+
])) : Pe("", !0);
|
|
1519
1718
|
}
|
|
1520
|
-
const
|
|
1719
|
+
const $t = /* @__PURE__ */ ee(wt, [["render", _t], ["__scopeId", "data-v-c7599d50"]]), jt = M({
|
|
1521
1720
|
name: "HeatmapLayer",
|
|
1522
1721
|
props: {
|
|
1523
1722
|
options: {
|
|
@@ -1526,20 +1725,20 @@ const xt = /* @__PURE__ */ K(pt, [["render", ht], ["__scopeId", "data-v-c7599d50
|
|
|
1526
1725
|
}
|
|
1527
1726
|
},
|
|
1528
1727
|
setup(o) {
|
|
1529
|
-
const e = v(), t =
|
|
1530
|
-
return
|
|
1728
|
+
const e = v(), t = _(q, v()), s = _(R, v());
|
|
1729
|
+
return O(
|
|
1531
1730
|
[t, () => o.options],
|
|
1532
|
-
([
|
|
1533
|
-
var
|
|
1534
|
-
const i = !A(
|
|
1535
|
-
if (t.value &&
|
|
1536
|
-
const u = structuredClone(
|
|
1537
|
-
if (u.data && !(u.data instanceof
|
|
1538
|
-
const
|
|
1539
|
-
u.data = (
|
|
1731
|
+
([r, n], [a, c]) => {
|
|
1732
|
+
var d;
|
|
1733
|
+
const i = !A(n, c) || t.value !== a;
|
|
1734
|
+
if (t.value && s.value && i) {
|
|
1735
|
+
const u = structuredClone(n);
|
|
1736
|
+
if (u.data && !(u.data instanceof s.value.MVCArray)) {
|
|
1737
|
+
const l = s.value.LatLng;
|
|
1738
|
+
u.data = (d = u.data) == null ? void 0 : d.map((h) => h instanceof l || "location" in h && (h.location instanceof l || h.location === null) ? h : "location" in h ? { ...h, location: new l(h.location) } : new l(h));
|
|
1540
1739
|
}
|
|
1541
|
-
e.value ? e.value.setOptions(u) : e.value =
|
|
1542
|
-
new
|
|
1740
|
+
e.value ? e.value.setOptions(u) : e.value = E(
|
|
1741
|
+
new s.value.visualization.HeatmapLayer({
|
|
1543
1742
|
...u,
|
|
1544
1743
|
map: t.value
|
|
1545
1744
|
})
|
|
@@ -1547,22 +1746,22 @@ const xt = /* @__PURE__ */ K(pt, [["render", ht], ["__scopeId", "data-v-c7599d50
|
|
|
1547
1746
|
}
|
|
1548
1747
|
},
|
|
1549
1748
|
{ immediate: !0 }
|
|
1550
|
-
),
|
|
1749
|
+
), j(() => {
|
|
1551
1750
|
e.value && e.value.setMap(null);
|
|
1552
1751
|
}), { heatmapLayer: e };
|
|
1553
1752
|
},
|
|
1554
1753
|
render: () => null
|
|
1555
1754
|
});
|
|
1556
1755
|
export {
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1756
|
+
St as Circle,
|
|
1757
|
+
At as CustomControl,
|
|
1758
|
+
$t as CustomMarker,
|
|
1759
|
+
Ot as GoogleMap,
|
|
1760
|
+
jt as HeatmapLayer,
|
|
1761
|
+
Tt as InfoWindow,
|
|
1762
|
+
Pt as Marker,
|
|
1763
|
+
It as MarkerCluster,
|
|
1764
|
+
Et as Polygon,
|
|
1765
|
+
xt as Polyline,
|
|
1766
|
+
Lt as Rectangle
|
|
1568
1767
|
};
|