Leaflet/Leaflet — pull request #1600 by kmrhb (2013-04-16 19:04:18+00:00)
Title: Include view information on view changed events

NB This PR is to initiate discussion and is not intended to be merged in its present state.

Events like `move*` and `zoom*` could tell their handlers a bit more about what is changing. I propose changing their documented type from Event to ViewEvent. The additional data would look something like this:

``` js
{ from:
{ center: {lat: 45.5081, lng: -73.555} // a LatLng object
, zoom: 13
}
, to:
{ center: {lat: 45.5081, lng: -73.555} // a LatLng object
, zoom: 14
}
}
```

Then the handlers can refer to `event.from.zoom` or `event.to.center` and so on instead of having to poke at `event.target`, where some of this information is only available through undocumented internal properties.

This would solve #1509, possibly among others.

You can see a start on this for the `zoomstart` event in this PR. This is the only event I need for what I'm trying to achieve, but I'd like to see this implemented. I'm hoping for some feedback before proceeding any further.

Questions:
* Which events need this information? I list `move*`, `zoom*`, `viewreset`, maybe `load`. Others?
* What information should be included? I've added lat/lng and zoom, but the pixel offsets might be of interest too.