Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct unspiderfy vector #604

Merged
merged 4 commits into from
Nov 26, 2015
Merged

Conversation

ghybs
Copy link
Contributor

@ghybs ghybs commented Nov 19, 2015

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 test suite.

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.
for consistency with previous checks in markercluster.spiderfier.
@danzel
Copy link
Member

danzel commented Nov 26, 2015

Should we test setZIndexOffset separately? I'm not sure if there is or will be a layer where one of these is supported and not the other.

@ghybs
Copy link
Contributor Author

ghybs commented Nov 26, 2015

Hi danzel,

I wondered the same question, but I realized the same check is done all over the place in that file: it just checks for setOpacity existence, then does a clusterHide (or Show) and setZIndexOffset.

We could modify all these checks to instanceof L.Marker or check for both methods existence, or as you say, separate each check with their respective method call.

What do you think?

Following danzel's comment in PR Leaflet#604.
@ghybs
Copy link
Contributor Author

ghybs commented Nov 26, 2015

Here you go.

I modified all places where we play with setZIndexOffset, clusterHide, clusterShow and _setPos to check for the corresponding method existence first. That way we do not assume anything.

By the way, I replaced the setOpacity(1) by the "new" clusterShow() method in MCG._unspiderfyLayer, so that it restores the initial opacity instead of setting it to 1.

danzel added a commit that referenced this pull request Nov 26, 2015
@danzel danzel merged commit a0ccbe0 into Leaflet:master Nov 26, 2015
@danzel
Copy link
Member

danzel commented Nov 26, 2015

Sounds good!

@ghybs ghybs deleted the correctUnspiderfyVector branch November 27, 2015 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants