function initializeNotes(map) {
var noteLayer = map.noteLayer,
- notes = {},
- newNote;
+ notes = {};
var noteIcons = {
"new": L.icon({
noteLayer.clearLayers();
notes = {};
}
- }).on("popupclose", function (e) {
- if (newNote && e.popup == newNote._popup) {
- $(newNote).oneTime(10, "removenote", function () {
- map.removeLayer(newNote);
- newNote = null;
- });
- }
- })
+ });
noteLayer.on('click', function(e) {
- OSM.route('/browse/note/' + e.layer.id);
- })
+ if (e.layer.id) {
+ OSM.router.route('/note/' + e.layer.id);
+ }
+ });
function updateMarker(marker, feature) {
if (marker) {
} else {
marker = L.marker(feature.geometry.coordinates.reverse(), {
icon: noteIcons[feature.properties.status],
- opacity: 0.9,
+ opacity: 0.8,
clickable: true
});
marker.id = feature.properties.id;
notes[feature.properties.id] = updateMarker(marker, feature);
}
- for (id in oldNotes) {
+ for (var id in oldNotes) {
noteLayer.removeLayer(oldNotes[id]);
}
noteLoader = null;
}
- };
+ }
}