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);
}
page.pushstate = page.popstate = function (path) {
- OSM.loadSidebarContent(path, page.load);
+ OSM.loadSidebarContent(path, function () {
+ page.load(path);
+ });
};
function newHalo(loc, a) {
}
}
- page.load = function () {
+ page.load = function (path) {
if (addNoteButton.hasClass("disabled")) return;
if (addNoteButton.hasClass("active")) return;
map.addLayer(noteLayer);
- var mapSize = map.getSize();
- var markerPosition;
+ var params = querystring.parse(path.substring(path.indexOf('?') + 1));
+ var markerLatlng;
- markerPosition = [mapSize.x / 2, mapSize.y / 2];
+ if (params.lat && params.lon) {
+ markerLatlng = L.latLng(params.lat, params.lon);
+ } else {
+ markerLatlng = map.getCenter();
+ }
+
+ map.panInside(markerLatlng, {
+ padding: [50, 50]
+ });
- newNote = L.marker(map.containerPointToLatLng(markerPosition), {
+ newNote = L.marker(markerLatlng, {
icon: noteIcons["new"],
opacity: 0.9,
draggable: true