]> git.openstreetmap.org Git - rails.git/blob - app/assets/javascripts/leaflet.note.js
Add sprite and geolocate alternate color
[rails.git] / app / assets / javascripts / leaflet.note.js
1 L.OSM.note = function (options) {
2   var control = L.control(options);
3
4   control.onAdd = function (map) {
5     var $container = $('<div>')
6       .attr('class', 'control-note');
7
8     $('<a>')
9       .attr('class', 'control-button')
10       .attr('href', '#')
11       .attr('title', 'Notes')
12       .html('<span class="icon note"></span>')
13       .on('click', toggle)
14       .appendTo($container);
15
16     function toggle(e) {
17       e.stopPropagation();
18       e.preventDefault();
19
20       if (map.hasLayer(map.noteLayer)) {
21         map.removeLayer(map.noteLayer);
22       } else {
23         map.addLayer(map.noteLayer);
24       }
25     }
26
27     return $container[0];
28   };
29
30   return control;
31 };