Skip to content

Conversation

Xelio
Copy link
Contributor

@Xelio Xelio commented Apr 29, 2013

Not only on clicking layer contorl, should also fire on add/remove of the overlay on other place.
jsfiddle

@jeroen
Copy link

jeroen commented Apr 29, 2013

Will this cause the event to fire 100 times when a geojson layer is added?

@Xelio
Copy link
Contributor Author

Xelio commented Apr 30, 2013

It would only fire if the layer added to layer control and would only fire once per add / remove.

@mourner
Copy link
Member

mourner commented Apr 30, 2013

This change seems to only hadle overlay changes, although base layers can be changed programmatically too (by removing one and adding the other, in which case overlay events would be fired).

…overlayadd'

'baselayerchange' event should fire with layer name(use object in _layers of L.Control.Layers) instead of only layer.
@Xelio
Copy link
Contributor Author

Xelio commented May 1, 2013

External base layer change now fire baselayerchange instead of overlayadd.
The layer object passed by baselayerchange event is now the object in _layers of L.Control.Layers which has name property. Instead of layer only.

@Xelio
Copy link
Contributor Author

Xelio commented May 1, 2013

And the change of base layer now only fire baselayerchange without overlayremove.
The jsfiddle is updated to test above changes.

@Xelio
Copy link
Contributor Author

Xelio commented May 1, 2013

Or should the layer name pass as another property, layer only pass as layer?

@Xelio
Copy link
Contributor Author

Xelio commented May 9, 2013

Any problem?

@mourner
Copy link
Member

mourner commented May 9, 2013

Nope, just didn't get to reviewing this pull again yet.

@ghost ghost assigned mourner Jun 6, 2013
mourner added a commit that referenced this pull request Jun 24, 2013
@mourner mourner merged commit 02b93b4 into Leaflet:master Jun 24, 2013
@mourner
Copy link
Member

mourner commented Jun 24, 2013

Simplified the code a bit and merged. I also changed the events to pass layer and name as separate properties as you suggested in a comment above.

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.

3 participants