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

Layer refactoring #2266

Merged
merged 14 commits into from Dec 6, 2013
Merged

Layer refactoring #2266

merged 14 commits into from Dec 6, 2013

Conversation

mourner
Copy link
Member

@mourner mourner commented Dec 5, 2013

A work in progress. This PR contains major refactoring of Leaflet layers architecture, creating a base Layer class for all layers to inherit from, and putting all shared layers logic there (as well as layers-related logic in Map.js), DRYing up and simplifying the code significantly, removing ugly hacks, as well as addressing #496 #1249 #1742 and other issues. A part of the major refactoring for Leaflet 1.0 #2210.

  • Added Layer class which all layers added to a map should inherit from.
  • Added add and remove events to all layers.
  • Added pane option to all layers that can be changed (e.g. you can set pane: 'overlayPane' to a tile layer).
  • Added shadowPane option to markers as well.
  • Added getEvents method to all layers that returns an {event: listener, ...} hash; layers now manage its listeners automatically without having to do this in onAdd/onRemove.
  • Improved performance of adding/removing layers with layers control present (instead of listening to any layer add/remove, the control only listens to layers added in configuration).
  • Fixed FeatureGroup getBounds to work correctly when containing circle markers.
  • Removed Map tilelayersload event.
  • Removed Popup open and close events in favor of add and remove for consistency.
  • Moved all layer-related logic in Map.js to Layer.js.

mourner added a commit that referenced this pull request Dec 6, 2013
@mourner mourner merged commit 90ab59b into master Dec 6, 2013
@mourner mourner deleted the layer branch December 6, 2013 13:12
@mourner
Copy link
Member Author

mourner commented Dec 6, 2013

@danzel @tmcw @jfirebaugh now merged in master, take a look, or just skim through the summary of changes in the description.


getPane: function (name) {
// TODO make pane if not present
var paneName = name ? this.options[name] || name : this.options.pane;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some brackets here would make this a bit more readable:
var paneName = name ? (this.options[name] || name) : this.options.pane;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, you're right :)

@danzel
Copy link
Member

danzel commented Dec 8, 2013

Read through, looks good

@mourner
Copy link
Member Author

mourner commented Dec 8, 2013

Thanks!

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.

None yet

3 participants