aboutsummaryrefslogtreecommitdiffstats
path: root/extlib/leaflet/src/layer/vector/Path.Popup.js
diff options
context:
space:
mode:
Diffstat (limited to 'extlib/leaflet/src/layer/vector/Path.Popup.js')
-rw-r--r--extlib/leaflet/src/layer/vector/Path.Popup.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/extlib/leaflet/src/layer/vector/Path.Popup.js b/extlib/leaflet/src/layer/vector/Path.Popup.js
new file mode 100644
index 00000000..b82a4920
--- /dev/null
+++ b/extlib/leaflet/src/layer/vector/Path.Popup.js
@@ -0,0 +1,24 @@
+/*
+ * Popup extension to L.Path (polylines, polygons, circles), adding bindPopup method.
+ */
+
+L.Path.include({
+ bindPopup: function(content, options) {
+ if (!this._popup || this._popup.options !== options) {
+ this._popup = new L.Popup(options);
+ }
+ this._popup.setContent(content);
+
+ if (!this._openPopupAdded) {
+ this.on('click', this._openPopup, this);
+ this._openPopupAdded = true;
+ }
+
+ return this;
+ },
+
+ _openPopup: function(e) {
+ this._popup.setLatLng(e.latlng);
+ this._map.openPopup(this._popup);
+ }
+}); \ No newline at end of file