From bef1dbb33e2ea4e79816046e91f0ddc5318d4698 Mon Sep 17 00:00:00 2001 From: danzel Date: Thu, 1 Nov 2012 09:32:51 +1300 Subject: [PATCH] Feature Detect SVG Animation and only use it if available. IE10 does not support it. Fixes #86 --- src/MarkerCluster.Spiderfier.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/MarkerCluster.Spiderfier.js b/src/MarkerCluster.Spiderfier.js index 2b52a2f76f..90d0c5ece1 100644 --- a/src/MarkerCluster.Spiderfier.js +++ b/src/MarkerCluster.Spiderfier.js @@ -132,6 +132,10 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? { } } : { //Animated versions here + SVG_ANIMATION: (function () { + return document.createElementNS('http://www.w3.org/2000/svg', 'animate').toString().indexOf('SVGAnimate') > -1; + }()), + _animationSpiderfy: function (childMarkers, positions) { var me = this, group = this._group, @@ -174,7 +178,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? { m._spiderLeg = leg; //Following animations don't work for canvas - if (!L.Path.SVG) { + if (!L.Path.SVG || !this.SVG_ANIMATION) { continue; } @@ -233,7 +237,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? { map = group._map, thisLayerPos = zoomDetails ? map._latLngToNewLayerPoint(this._latlng, zoomDetails.zoom, zoomDetails.center) : map.latLngToLayerPoint(this._latlng), childMarkers = this.getAllChildMarkers(), - svg = L.Path.SVG, + svg = L.Path.SVG && this.SVG_ANIMATION, m, i, a; group._animationStart();