Skip to content

Commit

Permalink
Adding breaking changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtoye committed Feb 7, 2013
1 parent a7bb1e8 commit 609b040
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
52 changes: 52 additions & 0 deletions BREAKINGCHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# How to upgrade from 0.1 to 0.2

There are a number of changes to the plugin in 0.2 that may break peoples implementations of Leaflet.draw 0.1. If you I will try my best to list any changes here.

## Event consolidation

Leaflet.draw 0.1 had a created event for each different shape that was created. 0.2 now consolitates these into a single created shape.

The vector or marker is accessed by the `layer` property of the event arguments, the type of layer by the `layerType`.

#### New way

````
map.on('draw:created', function (e) {
var type = e.layerType,
layer = e.layer;
if (type === 'marker') {
// Do any marker specific logic here
}
map.addLayer(layer);
});
````

#### Old way

````
map.on('draw:poly-created', function (e) {
map.addLayer(e.poly);
});
map.on('draw:rectangle-created', function (e) {
map.addLayer(e.rect);
});
map.on('draw:circle-created', function (e) {
map.addLayer(e.circ);
});
map.on('draw:marker-created', function (e) {
e.marker.bindPopup('A popup!');
map.addLayer(e.marker);
});
````

## Draw handler enabled/disabled event change

Renamed the drawing enabled and disabled events to be the same as the created standard.

`drawing` -> `draw:enabled` and `drawing-disabled` -> `draw:disabled`

## CSS changes

There has been a whole bunch of CSS changes, if you have customized any of these plese see [leaflet.draw.css](https://github.com/Leaflet/Leaflet.draw/blob/master/dist/leaflet.draw.css).
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#Leaflet.draw
Adds support for drawing and editing vectors and markers on [Leaflet maps](https://github.com/Leaflet/Leaflet). Check out the [demo](http://leaflet.github.com/Leaflet.draw/)

##### Table of Contents
#### Upgrading from Leaflet.draw 0.1

Leaflet.draw 0.2 changes a LOT of things from 0.1. Please see [BREAKING CHANGES](https://github.com/Leaflet/Leaflet.draw/blob/master/BREAKINGCHANGES.md) for how to upgrade.

## Table of Contents
[Using the plugin](#using)
[Advanced Options](#options)
[Command tasks](#tasks)
Expand Down

0 comments on commit 609b040

Please sign in to comment.