X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b9a19ab23a8dc63bc7c7f867e2ece6924319f0f2..7094370208712e77d92ea2ad0d76e160742d6c0a:/app/assets/javascripts/leaflet.note.js
diff --git a/app/assets/javascripts/leaflet.note.js b/app/assets/javascripts/leaflet.note.js
index 24f18f7ab..a38e012de 100644
--- a/app/assets/javascripts/leaflet.note.js
+++ b/app/assets/javascripts/leaflet.note.js
@@ -1,39 +1,20 @@
-L.Control.Note = L.Control.extend({
- options: {
- position: 'topright',
- title: 'Notes',
- },
+L.OSM.note = function (options) {
+ var control = L.control(options);
- onAdd: function (map) {
- var className = 'control-note',
- container = L.DomUtil.create('div', className);
+ control.onAdd = function (map) {
+ var $container = $('
')
+ .attr('class', 'control-note');
- var link = L.DomUtil.create('a', 'control-button', container);
- link.innerHTML = "
";
- link.href = '#';
- link.title = this.options.title;
+ $('
')
+ .attr('id', 'createnoteanchor')
+ .attr('class', 'control-button geolink')
+ .attr('data-minzoom', 12)
+ .attr('href', '#')
+ .html('')
+ .appendTo($container);
- L.DomEvent
- .on(link, 'click', L.DomEvent.stopPropagation)
- .on(link, 'click', L.DomEvent.preventDefault)
- .on(link, 'click', this._toggle, this)
- .on(link, 'dblclick', L.DomEvent.stopPropagation);
+ return $container[0];
+ };
- this.map = map;
-
- return container;
- },
-
- // TODO: this relies on notesLayer on the map
- _toggle: function() {
- if (this.map.hasLayer(this.map.noteLayer)) {
- this.map.removeLayer(this.map.noteLayer);
- } else {
- this.map.addLayer(this.map.noteLayer);
- }
- }
-});
-
-L.control.note = function(options) {
- return new L.Control.Note(options);
+ return control;
};