aboutsummaryrefslogtreecommitdiffstats
path: root/extlib/leaflet/src/layer/vector/Path.Popup.js
diff options
context:
space:
mode:
authorAditi <aditi.iitr@gmail.com>2013-06-21 23:09:22 +0530
committerAditi <aditi.iitr@gmail.com>2013-06-21 23:09:22 +0530
commit2719d546a57c2332e36cc056ac80ec5d79672c1a (patch)
tree1f62ab8f761026d4faa5442032df133fc90d47f2 /extlib/leaflet/src/layer/vector/Path.Popup.js
parent1a6f065419290b3f4234ce4a89bb2c46b13e8a12 (diff)
parent92b22e7deac547835f69168f97012b52e87b6de4 (diff)
downloadmediagoblin-2719d546a57c2332e36cc056ac80ec5d79672c1a.tar.lz
mediagoblin-2719d546a57c2332e36cc056ac80ec5d79672c1a.tar.xz
mediagoblin-2719d546a57c2332e36cc056ac80ec5d79672c1a.zip
Merge remote-tracking branch 'cweb/master'
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