[Pkg-javascript-commits] [leaflet-markercluster] 161/219: Corrected legOptions class assignment
Jonas Smedegaard
dr at jones.dk
Sat May 7 09:39:30 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 71ce1a1846e26c051e3e3dd6b6b25228fcd3fb28
Author: ghybs <ghybs1 at gmail.com>
Date: Thu Oct 22 23:38:46 2015 +0400
Corrected legOptions class assignment
Use a copy of spiderLegPolylineOptions so that we can directly change it without affecting the group option. We also no longer need to change each leg style individually, since the legOptions is now correct from the beginning.
---
src/MarkerCluster.Spiderfier.js | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/MarkerCluster.Spiderfier.js b/src/MarkerCluster.Spiderfier.js
index 5f302c4..9343168 100644
--- a/src/MarkerCluster.Spiderfier.js
+++ b/src/MarkerCluster.Spiderfier.js
@@ -168,7 +168,7 @@ L.MarkerCluster.include({
thisLayerLatLng = this._latlng,
thisLayerPos = map.latLngToLayerPoint(thisLayerLatLng),
svgAnim = L.Path.SVG && this.SVG_ANIMATION,
- legOptions = this._group.options.spiderLegPolylineOptions,
+ legOptions = L.extend({}, this._group.options.spiderLegPolylineOptions), // Copy the options so that we can modify them for animation.
finalLegOpacity = legOptions.opacity,
i, m, leg, legPath, legLength, newPos;
@@ -176,8 +176,16 @@ L.MarkerCluster.include({
finalLegOpacity = L.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity;
}
- // Add the class for CSS transitions.
- legOptions.className = (legOptions.className || '') + ' leaflet-cluster-spider-leg';
+ if (svgAnim) {
+ // If the initial opacity of the spider leg is not 0 then it appears before the animation starts.
+ legOptions.opacity = 0;
+
+ // Add the class for CSS transitions.
+ legOptions.className = (legOptions.className || '') + ' leaflet-cluster-spider-leg';
+ } else {
+ // Make sure we have a defined opacity.
+ legOptions.opacity = finalLegOpacity;
+ }
// Add markers and spider legs to map, hidden at our center point.
// Traverse in ascending order to make sure that inner circleMarkers are on top of further legs. Normal markers are re-ordered by newPosition.
@@ -189,11 +197,6 @@ L.MarkerCluster.include({
// Add the leg before the marker, so that in case the latter is a circleMarker, the leg is behind it.
leg = new L.Polyline([thisLayerLatLng, newPos], legOptions);
-
- // If the initial opacity of the spider leg is not 0 then it appears before the animation starts.
- if (svgAnim) {
- leg.setStyle({opacity: 0});
- }
map.addLayer(leg);
m._spiderLeg = leg;
--
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