[Pkg-javascript-commits] [leaflet] 221/301: handle any existing tilelayers when adding attribution control

Jonas Smedegaard js at moszumanska.debian.org
Mon Jan 27 22:22:52 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository leaflet.

commit d5383d24f7d28a2f864f331d1499684bb47ee477
Author: Steve Kashishian <steve at snkashis.com>
Date:   Sun Nov 10 11:50:05 2013 -0600

    handle any existing tilelayers when adding attribution control
---
 src/control/Control.Attribution.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/control/Control.Attribution.js b/src/control/Control.Attribution.js
index 3902f66..21eb1c5 100644
--- a/src/control/Control.Attribution.js
+++ b/src/control/Control.Attribution.js
@@ -18,6 +18,12 @@ L.Control.Attribution = L.Control.extend({
 		this._container = L.DomUtil.create('div', 'leaflet-control-attribution');
 		L.DomEvent.disableClickPropagation(this._container);
 
+		for (var i in map._layers) {
+			if (map._layers[i].getAttribution) {
+				this.addAttribution(map._layers[i].getAttribution());
+			}
+		}
+		
 		map
 		    .on('layeradd', this._onLayerAdd, this)
 		    .on('layerremove', this._onLayerRemove, this);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet.git



More information about the Pkg-javascript-commits mailing list