@maptiler/geocoding-control 0.0.91-git.4d23c0 → 0.0.91-git.535bd0
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/FeatureItem.svelte +1 -1
- package/GeocodingControl.svelte +18 -17
- package/GeocodingControl.svelte.d.ts +1 -0
- package/leaflet.js +1900 -1897
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +5 -5
- package/leaflet.umd.js.map +1 -1
- package/maplibregl.js +1853 -1850
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +5 -5
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.js +1852 -1849
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +5 -5
- package/maptilersdk.umd.js.map +1 -1
- package/package.json +1 -1
- package/react.js +402 -399
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/types.d.ts +12 -0
package/FeatureItem.svelte
CHANGED
|
@@ -8,7 +8,7 @@ $: imageUrl = category
|
|
|
8
8
|
? `/icons/${category.replace(/ /g, "_")}.svg`
|
|
9
9
|
: undefined;
|
|
10
10
|
$: placeType = feature.id.startsWith("poi.")
|
|
11
|
-
? feature.properties?.categories?.join("
|
|
11
|
+
? feature.properties?.categories?.join(", ")
|
|
12
12
|
: feature.properties?.place_type_name?.[0] ?? feature.place_type[0];
|
|
13
13
|
function handleImgError(e) {
|
|
14
14
|
if (index > -1) {
|
package/GeocodingControl.svelte
CHANGED
|
@@ -37,6 +37,7 @@ export let trackProximity = true;
|
|
|
37
37
|
export let types = undefined;
|
|
38
38
|
export let zoom = 16;
|
|
39
39
|
export let maxZoom = 18;
|
|
40
|
+
export let apiUrl = import.meta.env.VITE_API_URL;
|
|
40
41
|
export let fetchParameters = {};
|
|
41
42
|
export function focus() {
|
|
42
43
|
input.focus();
|
|
@@ -70,6 +71,7 @@ let cachedFeatures = [];
|
|
|
70
71
|
let abortController;
|
|
71
72
|
let searchTimeoutRef;
|
|
72
73
|
let focusedDelayed;
|
|
74
|
+
let prevIdToFly;
|
|
73
75
|
const dispatch = createEventDispatcher();
|
|
74
76
|
$: if (!trackProximity) {
|
|
75
77
|
proximity = undefined;
|
|
@@ -80,19 +82,22 @@ $: if (showFullGeometry &&
|
|
|
80
82
|
picked.geometry.type === "Point") {
|
|
81
83
|
search(picked.id, { byId: true }).catch((err) => (error = err));
|
|
82
84
|
}
|
|
83
|
-
$:
|
|
84
|
-
if (
|
|
85
|
-
(picked.bbox
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
$: {
|
|
86
|
+
if (mapController && picked && picked.id !== prevIdToFly && flyTo) {
|
|
87
|
+
if (!picked.bbox ||
|
|
88
|
+
(picked.bbox[0] === picked.bbox[2] && picked.bbox[1] === picked.bbox[3])) {
|
|
89
|
+
mapController.flyTo(picked.center, picked.id.startsWith("poi.") || picked.id.startsWith("address.")
|
|
90
|
+
? maxZoom
|
|
91
|
+
: zoom);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
mapController.fitBounds(unwrapBbox(picked.bbox), 50, maxZoom);
|
|
95
|
+
}
|
|
96
|
+
listFeatures = undefined;
|
|
97
|
+
markedFeatures = undefined;
|
|
98
|
+
selectedItemIndex = -1;
|
|
92
99
|
}
|
|
93
|
-
|
|
94
|
-
markedFeatures = undefined;
|
|
95
|
-
selectedItemIndex = -1;
|
|
100
|
+
prevIdToFly = picked?.id;
|
|
96
101
|
}
|
|
97
102
|
$: if (markedFeatures !== listFeatures) {
|
|
98
103
|
markedFeatures = undefined;
|
|
@@ -232,11 +237,7 @@ async function search(searchValue, { byId = false, exact = false, } = {}) {
|
|
|
232
237
|
sp.set("limit", String(limit));
|
|
233
238
|
}
|
|
234
239
|
sp.set("key", apiKey);
|
|
235
|
-
const url =
|
|
236
|
-
"/" +
|
|
237
|
-
encodeURIComponent(searchValue) +
|
|
238
|
-
".json?" +
|
|
239
|
-
sp.toString();
|
|
240
|
+
const url = apiUrl + "/" + encodeURIComponent(searchValue) + ".json?" + sp.toString();
|
|
240
241
|
if (url === lastSearchUrl) {
|
|
241
242
|
if (byId) {
|
|
242
243
|
listFeatures = undefined;
|
|
@@ -32,6 +32,7 @@ declare const __propDef: {
|
|
|
32
32
|
types?: string[] | undefined;
|
|
33
33
|
zoom?: number | undefined;
|
|
34
34
|
maxZoom?: number | undefined;
|
|
35
|
+
apiUrl?: string | undefined;
|
|
35
36
|
fetchParameters?: RequestInit | undefined;
|
|
36
37
|
focus?: (() => void) | undefined;
|
|
37
38
|
blur?: (() => void) | undefined;
|