]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/new_note.js
Merge pull request #1151 from polarbearing/patch-1
[rails.git] / app / assets / javascripts / index / new_note.js
index 53697e65b584d20686d3ee9bf3d200878fb9fac2..fa2872f456b572a515a17498bc2d2db30d7f0eb0 100644 (file)
@@ -69,7 +69,7 @@ OSM.NewNote = function(map) {
     var marker = L.marker(feature.geometry.coordinates.reverse(), {
       icon: noteIcons[feature.properties.status],
       opacity: 0.9,
-      clickable: true
+      interactive: true
     });
     marker.id = feature.properties.id;
     marker.addTo(noteLayer);
@@ -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,