Sha256: 656754277fa6637ebda86db77335907bd0ac5ddb131881885ddd7e4e7e586231

Contents?: true

Size: 551 Bytes

Versions: 3

Compression:

Stored size: 551 Bytes

Contents

/*
 * 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);
	}
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
leaflet-ruby-0.3.beta4 lib/leaflet/src/layer/vector/Path.Popup.js
leaflet-ruby-0.3.beta3 lib/leaflet/src/layer/vector/Path.Popup.js
leaflet-ruby-0.3.beta1 lib/leaflet/src/layer/vector/Path.Popup.js