[Pkg-javascript-commits] [leaflet-markercluster] 179/219: Correct unspiderfy L.Circle and removeOutsideVisibleBoundsSpec
Jonas Smedegaard
dr at jones.dk
Sat May 7 09:39:32 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet-markercluster.
commit f1ec8c5e0f2f65382ed02e104f886b8efab0ac28
Author: ghybs <ghybs1 at gmail.com>
Date: Thu Nov 19 11:23:31 2015 +0400
Correct unspiderfy L.Circle and removeOutsideVisibleBoundsSpec
L.Circle has `_latLng` and as such can be clustered and spiderfied. However, when unspiderfying, L.Circle does not have the `setOpacity` nor `setZIndexOffset` methods of L.Marker.
Also corrected removeOutsideVisibleBoundsSpec.
---
spec/suites/removeOutsideVisibleBoundsSpec.js | 1 -
src/MarkerCluster.Spiderfier.js | 9 ++++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/spec/suites/removeOutsideVisibleBoundsSpec.js b/spec/suites/removeOutsideVisibleBoundsSpec.js
index a9ce90f..71d9283 100644
--- a/spec/suites/removeOutsideVisibleBoundsSpec.js
+++ b/spec/suites/removeOutsideVisibleBoundsSpec.js
@@ -163,7 +163,6 @@ describe('Option removeOutsideVisibleBounds', function () {
var mapZoom = map.getZoom();
for (i = 0; i < markers.length; i++) {
- markers[i].setLatLng(latLngs[i]);
try {
expect(markers[i].__parent._zoom).to.be.below(mapZoom);
} catch (e) {
diff --git a/src/MarkerCluster.Spiderfier.js b/src/MarkerCluster.Spiderfier.js
index 3430fd0..059ff0b 100644
--- a/src/MarkerCluster.Spiderfier.js
+++ b/src/MarkerCluster.Spiderfier.js
@@ -398,9 +398,12 @@ L.MarkerClusterGroup.include({
if (layer._spiderLeg) {
this._featureGroup.removeLayer(layer);
- layer.setOpacity(1);
- //Position will be fixed up immediately in _animationUnspiderfy
- layer.setZIndexOffset(0);
+ // L.Circle can be spiderfied, but only Markers have setOpacity and setZIndexOffset methods.
+ if (layer instanceof L.Marker) {
+ layer.setOpacity(1);
+ //Position will be fixed up immediately in _animationUnspiderfy
+ layer.setZIndexOffset(0);
+ }
this._map.removeLayer(layer._spiderLeg);
delete layer._spiderLeg;
--
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