@maptiler/geocoding-control 3.0.0-rc.1 → 3.0.0-rc.3
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 +115 -51
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +17 -17
- package/dist/index.umd.js.map +1 -1
- package/dist/leaflet.public.js +47 -69
- package/dist/leaflet.public.js.map +1 -1
- package/dist/leaflet.public.umd.js +14 -14
- package/dist/leaflet.public.umd.js.map +1 -1
- package/dist/maplibregl.js +52 -74
- package/dist/maplibregl.js.map +1 -1
- package/dist/maplibregl.umd.js +14 -14
- package/dist/maplibregl.umd.js.map +1 -1
- package/dist/maptilersdk.js +49 -71
- package/dist/maptilersdk.js.map +1 -1
- package/dist/maptilersdk.umd.js +14 -14
- package/dist/maptilersdk.umd.js.map +1 -1
- package/dist/openlayers.public.js +1280 -0
- package/dist/openlayers.public.js.map +1 -0
- package/dist/openlayers.public.umd.js +276 -0
- package/dist/openlayers.public.umd.js.map +1 -0
- package/dist/src/controls/base-control.d.ts +44 -0
- package/dist/src/controls/leaflet-control.d.ts +4 -35
- package/dist/src/controls/maplibregl-control.d.ts +14 -35
- package/dist/src/controls/maptilersdk-control.d.ts +2 -1
- package/dist/src/controls/openlayers-control.d.ts +35 -0
- package/dist/src/controls/openlayers-events.d.ts +43 -0
- package/dist/src/controls/openlayers-options.d.ts +83 -0
- package/dist/src/geocoder/geocoder-options.d.ts +17 -1
- package/dist/src/geocoder/geocoder.d.ts +2 -1
- package/dist/src/openlayers.public.d.ts +7 -0
- package/dist/src/types.d.ts +1 -0
- package/package.json +9 -2
package/dist/leaflet.public.js
CHANGED
|
@@ -185,12 +185,12 @@ function be(t, e) {
|
|
|
185
185
|
for (const r of i.features)
|
|
186
186
|
if (r.geometry.type == "MultiPolygon")
|
|
187
187
|
for (const o of r.geometry.coordinates)
|
|
188
|
-
|
|
188
|
+
we(o, e);
|
|
189
189
|
else
|
|
190
|
-
|
|
190
|
+
we(r.geometry.coordinates, e);
|
|
191
191
|
return i;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function we(t, e) {
|
|
194
194
|
for (const i of t)
|
|
195
195
|
for (const r of i)
|
|
196
196
|
r[0] += e;
|
|
@@ -213,7 +213,7 @@ async function ft(t, e, i) {
|
|
|
213
213
|
a(Error("aborted"));
|
|
214
214
|
}), navigator.geolocation.getCurrentPosition(
|
|
215
215
|
(u) => {
|
|
216
|
-
s([u.coords.longitude, u.coords.latitude].map((
|
|
216
|
+
s([u.coords.longitude, u.coords.latitude].map((w) => w.toFixed(6)).join(","));
|
|
217
217
|
},
|
|
218
218
|
(u) => {
|
|
219
219
|
a(u);
|
|
@@ -356,10 +356,10 @@ _ = $([
|
|
|
356
356
|
C("maptiler-geocoder-feature-item")
|
|
357
357
|
], _);
|
|
358
358
|
const xt = "form{font-family:Open Sans,Ubuntu,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;z-index:10;border-radius:4px;margin:0;transition:max-width .25s;box-shadow:0 2px 5px #33335926;--color-text: #444952;--color-icon-button: #444952;pointer-events:all}form,form *,form *:after,form *:before{box-sizing:border-box}form.can-collapse{max-width:29px}form.can-collapse input::placeholder{transition:opacity .25s;opacity:0}form{width:270px;max-width:270px}form:focus-within,form:hover{width:270px;max-width:270px}form input::placeholder,form:focus-within input::placeholder,form:hover input::placeholder{opacity:1}input{font:inherit;font-size:14px;flex-grow:1;min-height:29px;background-color:transparent;color:#444952;white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul,div.error,div.no-results{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error,div.no-results{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error div{flex-grow:1}div.error maptiler-geocode-fail-icon{flex-shrink:0;width:20px;height:20px}div.error button{flex-shrink:0}div.error button maptiler-geocode-clear-icon{--color-icon-button: #e25041}div.error button:hover maptiler-geocode-clear-icon,div.error button:active maptiler-geocode-clear-icon{--color-icon-button: inherit}div.no-results{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results maptiler-geocode-fail-icon{margin-top:4px;flex-shrink:0;width:20px;height:20px}ul.options.open-on-top{top:auto;bottom:calc(100% + 6px)}button{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button:hover{background-color:transparent}button:hover,button:active{--color-icon-button: #2b8bfb}.input-group{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group:focus-within{outline:#2b8bfb solid 2px}.search-button{flex-shrink:0}.clear-button-container{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable{display:flex;flex-shrink:0}:host(.maptiler-geocoder):not(:empty){box-shadow:none}:host(.maptiler-geocoder) .input-group{border:white solid 2px}:host(.maptiler-geocoder) .input-group:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}:host(.maptiler-geocoder) form.can-collapse{max-width:33px}:host(.maptiler-geocoder) form,:host(.maptiler-geocoder) form:focus-within,:host(.maptiler-geocoder) form:hover{width:270px;max-width:270px}:host(.leaflet-geocoder) .input-group{border:white solid 1px}:host(.leaflet-geocoder) form.can-collapse{max-width:30px}";
|
|
359
|
-
var bt = Object.defineProperty,
|
|
359
|
+
var bt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, Fe = (t) => {
|
|
360
360
|
throw TypeError(t);
|
|
361
361
|
}, c = (t, e, i, r) => {
|
|
362
|
-
for (var o = r > 1 ? void 0 : r ?
|
|
362
|
+
for (var o = r > 1 ? void 0 : r ? wt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
|
|
363
363
|
(a = t[s]) && (o = (r ? a(e, i, o) : a(o)) || o);
|
|
364
364
|
return r && o && bt(e, i, o), o;
|
|
365
365
|
}, pe = (t, e, i) => e.has(t) || Fe("Cannot " + i), x = (t, e, i) => (pe(t, e, "read from private field"), i ? i.call(t) : e.get(t)), S = (t, e, i) => e.has(t) ? Fe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), W = (t, e, i, r) => (pe(t, e, "write to private field"), e.set(t, i), i), h = (t, e, i) => (pe(t, e, "access private method"), i), Z, V, z, ae, D, n, Q, Se, Ee, de, v, ue, K, fe, me, L, ge, H, Pe, ne, Be, Ge, Ue, ze, De;
|
|
@@ -378,7 +378,7 @@ let l = class extends M {
|
|
|
378
378
|
setOptions(t) {
|
|
379
379
|
const e = { ...t };
|
|
380
380
|
for (const i of Object.keys(e))
|
|
381
|
-
|
|
381
|
+
kt.includes(i) || delete e[i];
|
|
382
382
|
Object.assign(this, e);
|
|
383
383
|
}
|
|
384
384
|
/**
|
|
@@ -434,7 +434,7 @@ let l = class extends M {
|
|
|
434
434
|
willUpdate(t) {
|
|
435
435
|
t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, n, L).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && x(this, n, de) && (h(this, n, L).call(this), this.error = void 0), ["focused"].some((e) => t.has(e)) && setTimeout(() => {
|
|
436
436
|
this.focusedDelayed = this.focused, this.clearOnBlur && !this.focused && (this.searchValue = "");
|
|
437
|
-
}, 100), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, n, v).call(this, "select", { feature: x(this, n, Q) }), ["picked"].some((e) => t.has(e)) && this.picked && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? h(this, n, H).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
|
|
437
|
+
}, 100), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, n, v).call(this, "select", { feature: x(this, n, Q) }), ["picked"].some((e) => t.has(e)) && this.picked && this.picked.id !== t.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? h(this, n, H).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
|
|
438
438
|
() => {
|
|
439
439
|
h(this, n, v).call(this, "pick", { feature: this.picked });
|
|
440
440
|
},
|
|
@@ -526,7 +526,7 @@ let l = class extends M {
|
|
|
526
526
|
h(this, n, Ge).call(this, t);
|
|
527
527
|
}}
|
|
528
528
|
.missingIconsCache=${x(this, ae)}
|
|
529
|
-
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.
|
|
529
|
+
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.3/icons/"}
|
|
530
530
|
>
|
|
531
531
|
${t.place_name}
|
|
532
532
|
</maptiler-geocoder-feature-item>
|
|
@@ -606,18 +606,18 @@ H = async function(t, { byId: e = !1, exact: i = !1 } = {}) {
|
|
|
606
606
|
try {
|
|
607
607
|
const o = this.apiUrl ?? "https://api.maptiler.com/geocoding", s = h(this, n, K).call(this, t), a = new URL(o + "/" + encodeURIComponent(s ? `${s.decimalLongitude},${s.decimalLatitude}` : t) + ".json"), u = a.searchParams;
|
|
608
608
|
this.language !== void 0 && u.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
|
|
609
|
-
const [
|
|
610
|
-
let
|
|
611
|
-
(y) => typeof y == "string" ? y :
|
|
609
|
+
const [w] = x(this, D) ?? [void 0];
|
|
610
|
+
let k = (!s || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
|
|
611
|
+
(y) => typeof y == "string" ? y : w === void 0 || (y[0] ?? 0) <= w && w < (y[1] ?? 1 / 0) ? y[2] : void 0
|
|
612
612
|
).filter((y) => y !== void 0);
|
|
613
|
-
|
|
613
|
+
k && (k = [...new Set(k)], u.set("types", k.join(",")));
|
|
614
614
|
const T = !s || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
|
|
615
|
-
if (T && u.set("excludeTypes", String(T)), this.bbox && u.set("bbox", this.bbox.map((y) => y.toFixed(6)).join(",")), this.country && u.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), !e && !s) {
|
|
615
|
+
if (T && u.set("excludeTypes", String(T)), this.bbox && u.set("bbox", this.bbox.map((y) => y.toFixed(6)).join(",")), this.country && u.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && u.set("worldview", this.worldview), !e && !s) {
|
|
616
616
|
const y = this.proximity ?? [{ type: "server-geolocation" }], ve = await ft(x(this, D), y, r);
|
|
617
617
|
ve && u.set("proximity", ve), (i || this.showResultsWhileTyping === !1) && u.set("autocomplete", "false"), u.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
|
|
618
618
|
}
|
|
619
619
|
const ye = this.limit ?? 5, Y = this.reverseGeocodingLimit ?? ye;
|
|
620
|
-
Y > 1 &&
|
|
620
|
+
Y > 1 && k?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), s ? (Y === 1 || this.exhaustiveReverseGeocoding || k?.length === 1) && u.set("limit", String(Y)) : u.set("limit", String(ye)), this.apiKey && u.set("key", this.apiKey), this.adjustUrl?.(a);
|
|
621
621
|
const je = a.searchParams.get("types") === "" && a.searchParams.get("excludeTypes") !== "true", j = a.toString();
|
|
622
622
|
if (j === this.lastSearchUrl) {
|
|
623
623
|
e ? (this.clearListOnPick && h(this, n, L).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, n, v).call(this, "featureslisted", { features: this.listFeatures }), this.listFeatures[this.selectedItemIndex]?.id !== x(this, n, Q)?.id && (this.selectedItemIndex = -1));
|
|
@@ -796,6 +796,9 @@ c([
|
|
|
796
796
|
c([
|
|
797
797
|
p({ type: Array })
|
|
798
798
|
], l.prototype, "types", 2);
|
|
799
|
+
c([
|
|
800
|
+
p({ type: String })
|
|
801
|
+
], l.prototype, "worldview", 2);
|
|
799
802
|
c([
|
|
800
803
|
Ae("input")
|
|
801
804
|
], l.prototype, "input", 2);
|
|
@@ -832,7 +835,7 @@ c([
|
|
|
832
835
|
l = c([
|
|
833
836
|
C("maptiler-geocoder")
|
|
834
837
|
], l);
|
|
835
|
-
const
|
|
838
|
+
const kt = [
|
|
836
839
|
"adjustUrl",
|
|
837
840
|
"apiKey",
|
|
838
841
|
"apiUrl",
|
|
@@ -868,8 +871,9 @@ const wt = [
|
|
|
868
871
|
"showPlaceType",
|
|
869
872
|
"showResultsWhileTyping",
|
|
870
873
|
"types",
|
|
871
|
-
"reverseGeocodingTypes"
|
|
872
|
-
|
|
874
|
+
"reverseGeocodingTypes",
|
|
875
|
+
"worldview"
|
|
876
|
+
], _t = "svg{display:block;fill:var(--maptiler-geocode-marker-fill, #3170fe);stroke:var(--maptiler-geocode-marker-stroke, #3170fe);height:30px}:host(.marker-selected){z-index:2}:host(.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fill, #98b7ff);stroke:var(--maptiler-geocode-marker-selected-stroke, #3170fe)}:host(.marker-reverse) svg path{fill:var(--maptiler-geocode-marker-reverse-fill, silver);stroke:var(--maptiler-geocode-marker-reverse-stroke, gray)}:host(.marker-interactive){cursor:pointer!important}:host(.marker-fuzzy) svg path{fill:var(--maptiler-geocode-marker-fuzzy-fill, silver);stroke:var(--maptiler-geocode-marker-fuzzy-stroke, gray)}:host(.marker-fuzzy.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fuzzy-fill, #ddd);stroke:var(--maptiler-geocode-marker-selected-fuzzy-stroke, silver)}";
|
|
873
877
|
var $t = Object.getOwnPropertyDescriptor, Lt = (t, e, i, r) => {
|
|
874
878
|
for (var o = r > 1 ? void 0 : r ? $t(e, i) : e, s = t.length - 1, a; s >= 0; s--)
|
|
875
879
|
(a = t[s]) && (o = a(o) || o);
|
|
@@ -897,7 +901,7 @@ le.styles = I`
|
|
|
897
901
|
le = Lt([
|
|
898
902
|
C("maptiler-geocode-marker")
|
|
899
903
|
], le);
|
|
900
|
-
function
|
|
904
|
+
function ke(t) {
|
|
901
905
|
const e = tt(
|
|
902
906
|
q([
|
|
903
907
|
Ze([
|
|
@@ -918,14 +922,14 @@ function we(t) {
|
|
|
918
922
|
const i = U(X(t)), r = (i[2] - i[0]) / 360 / 1e3, o = i[0] < -180, s = i[2] > 180, a = it(t);
|
|
919
923
|
if (a.features.length > 1 && (o || s))
|
|
920
924
|
for (const u of a.features) {
|
|
921
|
-
const
|
|
922
|
-
if (s &&
|
|
923
|
-
for (const
|
|
924
|
-
for (const T of
|
|
925
|
+
const w = U(X(u));
|
|
926
|
+
if (s && w[0] < -180 + r)
|
|
927
|
+
for (const k of u.geometry.coordinates)
|
|
928
|
+
for (const T of k)
|
|
925
929
|
T[0] += 360 - r;
|
|
926
|
-
if (o &&
|
|
927
|
-
for (const
|
|
928
|
-
for (const T of
|
|
930
|
+
if (o && w[2] > 180 - r)
|
|
931
|
+
for (const k of u.geometry.coordinates)
|
|
932
|
+
for (const T of k)
|
|
929
933
|
T[0] -= 360 - r;
|
|
930
934
|
}
|
|
931
935
|
return q([a.features.length < 2 ? t : _e(a) ?? t, e]);
|
|
@@ -974,69 +978,37 @@ class jt extends Re {
|
|
|
974
978
|
constructor(e = {}) {
|
|
975
979
|
super(e);
|
|
976
980
|
}
|
|
981
|
+
/** @internal Not to be called directly */
|
|
977
982
|
onAdd(e) {
|
|
978
983
|
this.#e = e, this.#t = e.getContainer().ownerDocument.createElement("maptiler-geocoder"), this.#t.classList.add("leaflet-geocoder"), this.#m(), this.#x(), this.#I();
|
|
979
984
|
const i = e.getContainer().ownerDocument.createElement("div");
|
|
980
985
|
return i.classList.add("leaflet-ctrl-geocoder", "leaflet-bar"), i.style.zIndex = "850", i.appendChild(this.#t), xe.disableClickPropagation(i), xe.disableScrollPropagation(i), i;
|
|
981
986
|
}
|
|
987
|
+
/** @internal Not to be called directly */
|
|
982
988
|
onRemove() {
|
|
983
989
|
this.#b(), this.#M(), this.#e = void 0, this.#t = void 0;
|
|
984
990
|
}
|
|
985
|
-
/**
|
|
986
|
-
* Update the control options.
|
|
987
|
-
*
|
|
988
|
-
* @param options options to update
|
|
989
|
-
*/
|
|
990
991
|
setOptions(e) {
|
|
991
992
|
Object.assign(this.options, e), this.#m();
|
|
992
993
|
}
|
|
993
|
-
/**
|
|
994
|
-
* Set the content of search input box.
|
|
995
|
-
*
|
|
996
|
-
* @param value text to set
|
|
997
|
-
*/
|
|
998
994
|
setQuery(e) {
|
|
999
995
|
this.#t?.setQuery(e);
|
|
1000
996
|
}
|
|
1001
|
-
/**
|
|
1002
|
-
* Set the content of search input box and immediately submit it.
|
|
1003
|
-
*
|
|
1004
|
-
* @param value text to set and submit
|
|
1005
|
-
*/
|
|
1006
997
|
submitQuery(e) {
|
|
1007
998
|
this.#t?.submitQuery(e);
|
|
1008
999
|
}
|
|
1009
|
-
/**
|
|
1010
|
-
* Clear geocoding search results from the map.
|
|
1011
|
-
*/
|
|
1012
1000
|
clearMap() {
|
|
1013
1001
|
this.#r = [], this.#c(void 0, void 0);
|
|
1014
1002
|
}
|
|
1015
|
-
/**
|
|
1016
|
-
* Clear search result list.
|
|
1017
|
-
*/
|
|
1018
1003
|
clearList() {
|
|
1019
1004
|
this.#t?.clearList();
|
|
1020
1005
|
}
|
|
1021
|
-
/**
|
|
1022
|
-
* Set reverse geocoding mode.
|
|
1023
|
-
*
|
|
1024
|
-
* @param reverseActive reverse geocoding active
|
|
1025
|
-
*/
|
|
1026
1006
|
setReverseMode(e) {
|
|
1027
1007
|
this.setOptions({ reverseActive: e });
|
|
1028
1008
|
}
|
|
1029
|
-
/**
|
|
1030
|
-
* Focus the search input box.
|
|
1031
|
-
*
|
|
1032
|
-
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
1033
|
-
*/
|
|
1034
1009
|
focus(e) {
|
|
1035
1010
|
this.#t?.focus(e);
|
|
1036
1011
|
}
|
|
1037
|
-
/**
|
|
1038
|
-
* Blur the search input box.
|
|
1039
|
-
*/
|
|
1040
1012
|
blur() {
|
|
1041
1013
|
this.#t?.blur();
|
|
1042
1014
|
}
|
|
@@ -1076,7 +1048,7 @@ class jt extends Re {
|
|
|
1076
1048
|
},
|
|
1077
1049
|
pick: (e) => {
|
|
1078
1050
|
const i = e.detail.feature;
|
|
1079
|
-
i && i.id !== this.#d && this.#h && (this.#
|
|
1051
|
+
i && i.id !== this.#d && this.#h && (this.#w(i), this.#c(this.#r, i)), this.#d = i?.id, this.#i("pick", e.detail);
|
|
1080
1052
|
},
|
|
1081
1053
|
featuresshow: () => {
|
|
1082
1054
|
this.#i("featuresshow");
|
|
@@ -1086,7 +1058,7 @@ class jt extends Re {
|
|
|
1086
1058
|
},
|
|
1087
1059
|
featureslisted: (e) => {
|
|
1088
1060
|
const i = e.detail.features;
|
|
1089
|
-
this.#r = i, this.#c(this.#r, void 0), this.#
|
|
1061
|
+
this.#r = i, this.#c(this.#r, void 0), this.#k(i), this.#i("featureslisted", e.detail);
|
|
1090
1062
|
},
|
|
1091
1063
|
featuresclear: () => {
|
|
1092
1064
|
this.#r = void 0, this.#c(void 0, void 0), this.#i("featuresclear");
|
|
@@ -1127,10 +1099,10 @@ class jt extends Re {
|
|
|
1127
1099
|
#i(e, i) {
|
|
1128
1100
|
return super.fire(e, i);
|
|
1129
1101
|
}
|
|
1130
|
-
#
|
|
1102
|
+
#w(e) {
|
|
1131
1103
|
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#g({ lng: e.center[0], lat: e.center[1] }, this.#l(e)) : this.#y(U(e.bbox), 50, this.#l(e));
|
|
1132
1104
|
}
|
|
1133
|
-
#
|
|
1105
|
+
#k(e) {
|
|
1134
1106
|
if (!e || e.length === 0 || !this.#h) return;
|
|
1135
1107
|
const i = e.every((s) => s.matching_text), r = e.reduce(
|
|
1136
1108
|
(s, a) => i || !a.matching_text ? [Math.min(s[0], a.bbox[0]), Math.min(s[1], a.bbox[1]), Math.max(s[2], a.bbox[2]), Math.max(s[3], a.bbox[3])] : s,
|
|
@@ -1195,10 +1167,10 @@ class jt extends Re {
|
|
|
1195
1167
|
if (o.length > 0) {
|
|
1196
1168
|
const s = _e(q(o.map((a) => Qe(a))));
|
|
1197
1169
|
if (s) {
|
|
1198
|
-
const a =
|
|
1170
|
+
const a = ke({ ...i, geometry: s.geometry });
|
|
1199
1171
|
if (a) {
|
|
1200
|
-
const u = [...a.features],
|
|
1201
|
-
|
|
1172
|
+
const u = [...a.features], w = U(X(i)), k = w[2] - w[0];
|
|
1173
|
+
w[0] - k / 4 < -180 && u.push(...be(a, -360).features), w[2] + k / 4 > 180 && u.push(...be(a, 360).features), this.#s?.addData(q(u));
|
|
1202
1174
|
}
|
|
1203
1175
|
}
|
|
1204
1176
|
} else {
|
|
@@ -1211,7 +1183,7 @@ class jt extends Re {
|
|
|
1211
1183
|
});
|
|
1212
1184
|
}
|
|
1213
1185
|
} else if (i?.geometry.type.endsWith("Polygon")) {
|
|
1214
|
-
const o =
|
|
1186
|
+
const o = ke(i);
|
|
1215
1187
|
o && this.#s?.addData(o), this.options.pickedResultStyle === "full-geometry-including-polygon-center-marker" && r();
|
|
1216
1188
|
} else i?.geometry.type.endsWith("LineString") ? this.#s?.addData(i) : i?.geometry.type.endsWith("Point") && r();
|
|
1217
1189
|
if (this.options.showResultMarkers !== !1 && this.options.showResultMarkers !== null)
|
|
@@ -1246,7 +1218,7 @@ class jt extends Re {
|
|
|
1246
1218
|
}
|
|
1247
1219
|
#I() {
|
|
1248
1220
|
this.#e && (this.#s = new Je(void 0, {
|
|
1249
|
-
style: this
|
|
1221
|
+
style: this.#C(),
|
|
1250
1222
|
interactive: !1
|
|
1251
1223
|
}).addTo(this.#e));
|
|
1252
1224
|
}
|
|
@@ -1256,6 +1228,12 @@ class jt extends Re {
|
|
|
1256
1228
|
#p(e, i) {
|
|
1257
1229
|
return typeof i != "object" && (i = { icon: new Xe({ html: this.#e?.getContainer().ownerDocument.createElement("maptiler-geocode-marker"), iconAnchor: [12.3, 30], className: "" }) }), new et(e, i);
|
|
1258
1230
|
}
|
|
1231
|
+
#C() {
|
|
1232
|
+
const { fullGeometryStyle: e } = this.options;
|
|
1233
|
+
if (e === !0 || e === void 0) return Mt;
|
|
1234
|
+
if (!(e === !1 || e === null))
|
|
1235
|
+
return e;
|
|
1236
|
+
}
|
|
1259
1237
|
}
|
|
1260
1238
|
export {
|
|
1261
1239
|
Mt as DEFAULT_GEOMETRY_STYLE,
|