@maptiler/geocoding-control 0.0.91-git.896be4 → 0.0.91
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 +16 -10
- package/FeatureItem.svelte.d.ts +1 -0
- package/GeocodingControl.svelte +19 -13
- package/leaflet.js +1249 -1235
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +5 -5
- package/leaflet.umd.js.map +1 -1
- package/maplibregl.js +1365 -1351
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +5 -5
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.js +1364 -1350
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +5 -5
- package/maptilersdk.umd.js.map +1 -1
- package/package.json +6 -6
- package/react.js +784 -770
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
package/FeatureItem.svelte
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
<script>export let feature;
|
|
2
2
|
export let selected = false;
|
|
3
3
|
export let showPlaceType;
|
|
4
|
+
export let missingIconsCache;
|
|
4
5
|
const categories = feature.properties?.categories;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
$:
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
let category;
|
|
7
|
+
let imageUrl;
|
|
8
|
+
$: index = categories?.length ?? 0;
|
|
9
|
+
$: {
|
|
10
|
+
do {
|
|
11
|
+
index--;
|
|
12
|
+
category = categories?.[index];
|
|
13
|
+
imageUrl = category
|
|
14
|
+
? `/icons/${category.replace(/ /g, "_")}.svg`
|
|
15
|
+
: undefined;
|
|
16
|
+
} while (index > -1 && (!imageUrl || missingIconsCache.has(imageUrl)));
|
|
17
|
+
}
|
|
10
18
|
$: placeType = feature.id.startsWith("poi.")
|
|
11
19
|
? feature.properties?.categories?.join(", ")
|
|
12
20
|
: feature.properties?.place_type_name?.[0] ?? feature.place_type[0];
|
|
13
21
|
function handleImgError(e) {
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
e.style.visibility = "hidden";
|
|
22
|
+
if (imageUrl) {
|
|
23
|
+
missingIconsCache.add(imageUrl);
|
|
19
24
|
}
|
|
25
|
+
index--;
|
|
20
26
|
}
|
|
21
27
|
</script>
|
|
22
28
|
|
package/FeatureItem.svelte.d.ts
CHANGED
package/GeocodingControl.svelte
CHANGED
|
@@ -71,6 +71,8 @@ let cachedFeatures = [];
|
|
|
71
71
|
let abortController;
|
|
72
72
|
let searchTimeoutRef;
|
|
73
73
|
let focusedDelayed;
|
|
74
|
+
let prevIdToFly;
|
|
75
|
+
const missingIconsCache = new Set();
|
|
74
76
|
const dispatch = createEventDispatcher();
|
|
75
77
|
$: if (!trackProximity) {
|
|
76
78
|
proximity = undefined;
|
|
@@ -81,19 +83,22 @@ $: if (showFullGeometry &&
|
|
|
81
83
|
picked.geometry.type === "Point") {
|
|
82
84
|
search(picked.id, { byId: true }).catch((err) => (error = err));
|
|
83
85
|
}
|
|
84
|
-
$:
|
|
85
|
-
if (
|
|
86
|
-
(picked.bbox
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
$: {
|
|
87
|
+
if (mapController && picked && picked.id !== prevIdToFly && flyTo) {
|
|
88
|
+
if (!picked.bbox ||
|
|
89
|
+
(picked.bbox[0] === picked.bbox[2] && picked.bbox[1] === picked.bbox[3])) {
|
|
90
|
+
mapController.flyTo(picked.center, picked.id.startsWith("poi.") || picked.id.startsWith("address.")
|
|
91
|
+
? maxZoom
|
|
92
|
+
: zoom);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
mapController.fitBounds(unwrapBbox(picked.bbox), 50, maxZoom);
|
|
96
|
+
}
|
|
97
|
+
listFeatures = undefined;
|
|
98
|
+
markedFeatures = undefined;
|
|
99
|
+
selectedItemIndex = -1;
|
|
93
100
|
}
|
|
94
|
-
|
|
95
|
-
markedFeatures = undefined;
|
|
96
|
-
selectedItemIndex = -1;
|
|
101
|
+
prevIdToFly = picked?.id;
|
|
97
102
|
}
|
|
98
103
|
$: if (markedFeatures !== listFeatures) {
|
|
99
104
|
markedFeatures = undefined;
|
|
@@ -449,13 +454,14 @@ function unwrapBbox(bbox0) {
|
|
|
449
454
|
on:mouseleave={() => (selectedItemIndex = -1)}
|
|
450
455
|
on:blur={() => undefined}
|
|
451
456
|
>
|
|
452
|
-
{#each listFeatures as feature, i (feature.id)}
|
|
457
|
+
{#each listFeatures as feature, i (feature.id + (feature.address ? "," + feature.address : ""))}
|
|
453
458
|
<FeatureItem
|
|
454
459
|
{feature}
|
|
455
460
|
{showPlaceType}
|
|
456
461
|
selected={selectedItemIndex === i}
|
|
457
462
|
on:mouseenter={() => (selectedItemIndex = i)}
|
|
458
463
|
on:focus={() => pick(feature)}
|
|
464
|
+
{missingIconsCache}
|
|
459
465
|
/>
|
|
460
466
|
{/each}
|
|
461
467
|
</ul>
|