if ($(this).hasClass('disabled')) return;
- OSM.route('/new_note');
+ OSM.router.route('/new_note');
});
function createNote(marker, form, url) {
- var location = marker.getLatLng();
+ var location = marker.getLatLng().wrap();
marker.options.draggable = false;
marker.dragging.disable();
OSM.loadSidebarContent(path, page.load);
};
+ function newHalo(loc, a) {
+ if (a == 'dragstart' && map.hasLayer(halo)) {
+ map.removeLayer(halo);
+ } else {
+ if (map.hasLayer(halo)) map.removeLayer(halo);
+
+ halo = L.circleMarker(loc, {
+ weight: 2.5,
+ radius: 20,
+ fillOpacity: 0.5,
+ color: "#FF6200"
+ });
+
+ map.addLayer(halo);
+ }
+ }
+
page.load = function () {
if (addNoteButton.hasClass("disabled")) return;
if (addNoteButton.hasClass("active")) return;
draggable: true
});
- newNote.addTo(noteLayer);
-
- halo = L.circleMarker(map.containerPointToLatLng(markerPosition), {
- weight: 2.5,
- radius: 20,
- fillOpacity: 0.5,
- color: "#FF6200"
+ newNote.on("dragstart dragend", function(a) {
+ newHalo(newNote.getLatLng(), a.type);
});
- map.addLayer(halo);
+ newNote.addTo(noteLayer);
+ newHalo(newNote.getLatLng());
newNote.on("remove", function () {
addNoteButton.removeClass("active");
e.preventDefault();
createNote(newNote, e.target.form, '/api/0.6/notes.json');
});
+
+ return map.getState();
};
page.unload = function () {