diff options
author | Joar Wandborg <git@wandborg.com> | 2012-01-28 18:47:01 +0100 |
---|---|---|
committer | Joar Wandborg <git@wandborg.com> | 2012-01-28 18:47:01 +0100 |
commit | 3d0d3bc97270095fae5f9a2508068631c46a5e61 (patch) | |
tree | 76778fcacaae35fc5662f276dab512a07bcee186 /extlib/leaflet/src/layer/marker/Marker.Popup.js | |
parent | d7bec8577ea1b4d83df097f586324445fed1ef50 (diff) | |
parent | 9542a2ba076b7e00e79d7adb1a4e90a095427645 (diff) | |
download | mediagoblin-3d0d3bc97270095fae5f9a2508068631c46a5e61.tar.lz mediagoblin-3d0d3bc97270095fae5f9a2508068631c46a5e61.tar.xz mediagoblin-3d0d3bc97270095fae5f9a2508068631c46a5e61.zip |
Merge remote-tracking branch 'joar/exif-rebase'
Diffstat (limited to 'extlib/leaflet/src/layer/marker/Marker.Popup.js')
-rw-r--r-- | extlib/leaflet/src/layer/marker/Marker.Popup.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/extlib/leaflet/src/layer/marker/Marker.Popup.js b/extlib/leaflet/src/layer/marker/Marker.Popup.js new file mode 100644 index 00000000..4c5cad04 --- /dev/null +++ b/extlib/leaflet/src/layer/marker/Marker.Popup.js @@ -0,0 +1,28 @@ +/*
+ * Popup extension to L.Marker, adding openPopup & bindPopup methods.
+ */
+
+L.Marker.include({
+ openPopup: function() {
+ this._popup.setLatLng(this._latlng);
+ this._map.openPopup(this._popup);
+
+ return this;
+ },
+
+ closePopup: function() {
+ if (this._popup) {
+ this._popup._close();
+ }
+ },
+
+ bindPopup: function(content, options) {
+ options = L.Util.extend({offset: this.options.icon.popupAnchor}, options);
+
+ this._popup = new L.Popup(options);
+ this._popup.setContent(content);
+ this.on('click', this.openPopup, this);
+
+ return this;
+ }
+});
\ No newline at end of file |