diff --git a/html/static/js/map-locator.js b/html/static/js/map-locator.js
index ab10e65a..251bc9dd 100644
--- a/html/static/js/map-locator.js
+++ b/html/static/js/map-locator.js
@@ -125,12 +125,12 @@ class MapLocator extends HTMLElement {
this._map.jumpTo(args);
}
+ PanTo(coords, options) {
+ this._map.panTo(coords, options);
+ }
+
SetMarker(coords) {
console.log("Setting map marker", coords);
- this._map.jumpTo({
- center: coords,
- zoom: 14,
- });
this._markers.forEach((marker) => marker.remove());
const marker = new mapboxgl.Marker({
diff --git a/rmo/template/nuisance.html b/rmo/template/nuisance.html
index 10720db9..7c5b84fa 100644
--- a/rmo/template/nuisance.html
+++ b/rmo/template/nuisance.html
@@ -12,6 +12,7 @@
const MAPBOX_ACCESS_TOKEN = "{{.MapboxToken}}";
async function handleMapClick(mapLocator, lngLat) {
mapLocator.SetMarker(lngLat);
+ mapLocator.PanTo(lngLat, {duration: 2000});
const response = await geocodeReverse(MAPBOX_ACCESS_TOKEN, {
lat: lngLat.lat,
lng: lngLat.lng,
@@ -115,10 +116,12 @@ document.addEventListener('DOMContentLoaded', function() {
},
zoom: 14,
});
- mapLocator.SetMarker([
+ const coords = [
position.coords.longitude,
position.coords.latitude,
- ]);
+ ];
+ mapLocator.SetMarker(coords);
+ mapLocator.JumpTo({center: coords, zoom: 14});
handleMarkerDrag({
lat: position.coords.latitude,
lng: position.coords.longitude,