Skip to content

Commit

Permalink
ux improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
zdila committed Oct 1, 2022
1 parent c29daac commit 1f6a9dc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lib/Geocoding.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@
$: if (picked) {
map.fitBounds(picked.bbox);
features = [];
selected = undefined;
index = -1;
}
$: {
for (const [id, marker] of markers.entries()) {
console.log("DEL", id);
marker.remove();
}
Expand All @@ -49,8 +50,6 @@
new MarkerIcon({ target: element });
console.log("ADD", feature.id);
markers.set(
feature.id,
new maplibregl.Marker({ element }).setLngLat(feature.center).addTo(map)
Expand Down Expand Up @@ -109,6 +108,7 @@
features = fc.features;
}
// highlight selected marker
$: {
if (selectedMarker) {
selectedMarker.getElement().classList.toggle("marker-selected", false);
Expand All @@ -121,6 +121,7 @@
let focusedDelayed: boolean;
// close dropdown in the next cycle so that the selected item event has the chance to fire
$: setTimeout(() => {
focusedDelayed = focused;
});
Expand Down Expand Up @@ -149,6 +150,7 @@
}
}
// clear selecion on edit
$: searchValue, (selected = undefined, index = -1);
</script>
Expand Down

0 comments on commit 1f6a9dc

Please sign in to comment.