From: Tom Hughes Date: Wed, 2 Jan 2019 11:03:06 +0000 (+0000) Subject: Replace custom panning with new panInside leaflet method X-Git-Tag: live~2762 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/4b0fed0aa43651026fb4efa39c0409171942e608?hp=3e2b3c31beeb27ecf5c7f8988c211b0f5e30de9a;ds=inline Replace custom panning with new panInside leaflet method --- diff --git a/app/assets/javascripts/index/new_note.js b/app/assets/javascripts/index/new_note.js index 54c0b0db1..fa2872f45 100644 --- a/app/assets/javascripts/index/new_note.js +++ b/app/assets/javascripts/index/new_note.js @@ -112,28 +112,14 @@ OSM.NewNote = function(map) { if (params.lat && params.lon) { markerLatlng = L.latLng(params.lat, params.lon); - - var markerPosition = map.latLngToContainerPoint(markerLatlng), - mapSize = map.getSize(), - panBy = L.point(0, 0); - - if (markerPosition.x < 50) { - panBy.x = markerPosition.x - 50; - } else if (markerPosition.x > mapSize.x - 50) { - panBy.x = 50 - mapSize.x + markerPosition.x; - } - - if (markerPosition.y < 50) { - panBy.y = markerPosition.y - 50; - } else if (markerPosition.y > mapSize.y - 50) { - panBy.y = 50 - mapSize.y + markerPosition.y; - } - - map.panBy(panBy); } else { markerLatlng = map.getCenter(); } + map.panInside(markerLatlng, { + padding: [50, 50] + }); + newNote = L.marker(markerLatlng, { icon: noteIcons["new"], opacity: 0.9,