leaflet-editable
Advanced tools
Comparing version 0.4.0 to 0.5.0
# CHANGELOG | ||
## 0.5.0 | ||
- added editable:vertex:drag event | ||
- added editable:vertex:dragstart event | ||
- added editable:vertex:dragend event | ||
## 0.4.0 | ||
@@ -4,0 +9,0 @@ - Marker/Polygon/Polyline.createEditor now pass this.options.editOptions to |
{ | ||
"name": "leaflet-editable", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Make geometries editable in Leaflet", | ||
@@ -5,0 +5,0 @@ "main": "src/Leaflet.Editable.js", |
@@ -60,2 +60,3 @@ # Leaflet.Editable | ||
- [Display a tooltip near cursor while drawing](http://yohanboniface.github.io/Leaflet.Editable/example/tooltip-when-drawing.html) | ||
- Example of [Leaflet.Snap](https://github.com/makinacorpus/Leaflet.Snap/) integration [to enable snapping](http://yohanboniface.github.io/Leaflet.Editable/example/snapping.html) | ||
@@ -97,2 +98,6 @@ | ||
| editable:vertex:deleted | originalEvent, latlng, vertex, layer | Fired after a vertex has been deleted by user | | ||
| editable:vertex:deleted | originalEvent, latlng, vertex, layer | Fired after a vertex has been deleted by user | | ||
| editable:vertex:drag | originalEvent, latlng, vertex, layer | Fired when a vertex is dragged by user | | ||
| editable:vertex:dragstart | originalEvent, latlng, vertex, layer | Fired before a vertex is dragged by user | | ||
| editable:vertex:dragend | originalEvent, latlng, vertex, layer | Fired after a vertex is dragged by user | | ||
@@ -143,3 +148,3 @@ | ||
Same a L.Map. | ||
Same as L.Map. | ||
@@ -146,0 +151,0 @@ |
@@ -240,3 +240,5 @@ L.Editable = L.Class.extend({ | ||
L.Marker.prototype.onAdd.call(this, map); | ||
L.DomEvent.on(this.dragging._draggable, 'drag', this.onDrag, this); | ||
this.on('drag', this.onDrag); | ||
this.on('dragstart', this.onDragStart); | ||
this.on('dragend', this.onDragEnd); | ||
this.on('click', this.onClick); | ||
@@ -249,2 +251,4 @@ this.on('contextmenu', this.onContextMenu); | ||
onDrag: function (e) { | ||
e.vertex = this; | ||
this.editor.onVertexMarkerDrag(e); | ||
var iconPos = L.DomUtil.getPosition(this._icon), | ||
@@ -264,2 +268,12 @@ latlng = this._map.layerPointToLatLng(iconPos); | ||
onDragStart: function (e) { | ||
e.vertex = this; | ||
this.editor.onVertexMarkerDragStart(e); | ||
}, | ||
onDragEnd: function (e) { | ||
e.vertex = this; | ||
this.editor.onVertexMarkerDragEnd(e); | ||
}, | ||
onClick: function (e) { | ||
@@ -668,2 +682,14 @@ e.vertex = this; | ||
onVertexMarkerDrag: function (e) { | ||
this.fireAndForward('editable:vertex:drag', e); | ||
}, | ||
onVertexMarkerDragStart: function (e) { | ||
this.fireAndForward('editable:vertex:dragstart', e); | ||
}, | ||
onVertexMarkerDragEnd: function (e) { | ||
this.fireAndForward('editable:vertex:dragend', e); | ||
}, | ||
startDrawing: function () { | ||
@@ -670,0 +696,0 @@ if (!this._drawnLatLngs) this._drawnLatLngs = this.getLatLngs(); |
Sorry, the diff of this file is not supported yet
81585
18
1305
253