summaryrefslogtreecommitdiff
path: root/chimere/static/leaflet-plugins/control/Permalink.Marker.js
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-04-27 23:35:11 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2015-04-27 23:35:11 +0200
commit1469e4552b0f9b789c46b3ce027d4acb9f906dbd (patch)
tree42363492b9157f396139511acb73a1ed73fe53a7 /chimere/static/leaflet-plugins/control/Permalink.Marker.js
parentc6f7e24e373142e8618f4b6ed60df04bc0872354 (diff)
downloadChimère-leaflet-permalink.tar.bz2
Chimère-leaflet-permalink.zip
Add leaflet-pluginsleaflet-permalink
Diffstat (limited to 'chimere/static/leaflet-plugins/control/Permalink.Marker.js')
-rw-r--r--chimere/static/leaflet-plugins/control/Permalink.Marker.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/chimere/static/leaflet-plugins/control/Permalink.Marker.js b/chimere/static/leaflet-plugins/control/Permalink.Marker.js
new file mode 100644
index 0000000..360f06f
--- /dev/null
+++ b/chimere/static/leaflet-plugins/control/Permalink.Marker.js
@@ -0,0 +1,29 @@
+//#include "Permalink.js
+
+L.Control.Permalink.include({
+ /*
+ options: {
+ useMarker: true,
+ markerOptions: {}
+ },
+ */
+
+ initialize_marker: function() {
+ this.on('update', this._set_marker, this);
+ },
+
+ _set_marker: function(e) {
+ var p = e.params;
+ //if (!this.options.useMarker) return;
+ if (this._marker) return;
+ if (p.marker !== 1) return;
+ if (p.mlat !== undefined && p.mlon !== undefined)
+ return this._update({mlat: null, mlon: null,
+ lat: p.mlat, lon: p.mlon, marker: 1});
+ this._marker = new L.Marker(new L.LatLng(p.lat, p.lon),
+ this.options.markerOptions);
+ this._marker.bindPopup('<a href="' + this._update_href() + '">' + this.options.text + '</a>');
+ this._map.addLayer(this._marker);
+ this._update({marker: null});
+ }
+});