[Pkg-javascript-commits] [leaflet-markercluster] 256/479: When adding layers, don't add them to the map unless they are in the visible bounds. Fixes #69

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:37 UTC 2014


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

js pushed a commit to branch master
in repository leaflet-markercluster.

commit 5d8b11c94d6ad370165b345cd18ceaaed79bf905
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Sep 28 09:37:10 2012 +1200

    When adding layers, don't add them to the map unless they are in the visible bounds. Fixes #69
---
 src/MarkerClusterGroup.js | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 3df7a12..1dba89c 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -88,10 +88,12 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 			}
 		}
 
-		if (this.options.animateAddingMarkers) {
-			this._animationAddLayer(layer, visibleLayer);
-		} else {
-			this._animationAddLayerNonAnimated(layer, visibleLayer);
+		if (this._currentShownBounds.contains(visibleLayer.getLatLng())) {
+			if (this.options.animateAddingMarkers) {
+				this._animationAddLayer(layer, visibleLayer);
+			} else {
+				this._animationAddLayerNonAnimated(layer, visibleLayer);
+			}
 		}
 		return this;
 	},

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



More information about the Pkg-javascript-commits mailing list