leaflet-editable
Advanced tools
Comparing version 1.0.0 to 1.1.0
# CHANGELOG | ||
# dev | ||
# 1.1.0 | ||
- compatibility with Leaflet 1.2.0 | ||
- add `editable:vertex:new` event | ||
# 1.0.0 | ||
- BREAKING editorClass are now properly looked in editTools.options instead of map (cf #92) | ||
@@ -11,4 +17,2 @@ - removed Leaflet as peerDependency (cf #72) | ||
- fixed editable:drawing:commit being fired on mousedown instead of mouseup for circle and rectangle (cf #70) | ||
# 1.0.0-rc.1 | ||
- hide middle markers if there is not enough space | ||
@@ -40,2 +44,3 @@ - make possible to add new vertex on top of other paths vertex | ||
- added support for L.Rectangle and L.Circle drawing and editing | ||
- do not try to extend Leaflet classes not exposed (cf #83) | ||
@@ -42,0 +47,0 @@ ## 0.5.0 |
{ | ||
"name": "leaflet-editable", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Make geometries editable in Leaflet", | ||
@@ -19,3 +19,3 @@ "main": "src/Leaflet.Editable.js", | ||
"leafdoc": "^1.4.0", | ||
"leaflet": "^1.0.1", | ||
"leaflet": "^1.2.0", | ||
"leaflet.path.drag": "0.0.2", | ||
@@ -22,0 +22,0 @@ "mocha": "^2.5.3", |
[![Build Status](https://travis-ci.org/Leaflet/Leaflet.Editable.svg?branch=master)](https://travis-ci.org/Leaflet/Leaflet.Editable) | ||
# Leaflet.Editable | ||
# Leaflet.Editable | ||
@@ -25,3 +25,3 @@ Make geometries editable in Leaflet. | ||
## Install | ||
## Install | ||
@@ -35,3 +35,3 @@ You need Leaflet >= 1.0.0, and then include `src/Leaflet.Editable.js`. | ||
## Quick start | ||
## Quick start | ||
@@ -58,3 +58,3 @@ Allow Leaflet.Editable in the map options: | ||
## Examples | ||
## Examples | ||
@@ -72,3 +72,3 @@ - [Basic controls](http://Leaflet.github.io/Leaflet.Editable/example/index.html) | ||
## API | ||
## API | ||
@@ -78,4 +78,4 @@ [See the reference](http://Leaflet.github.io/Leaflet.Editable/doc/api.html) | ||
## Licence | ||
## Licence | ||
`Leaflet.Editable` is released under the WTFPL licence. |
@@ -592,2 +592,42 @@ 'use strict'; | ||
it('should fire editable:vertex:new ', function () { | ||
var newCount = 0, | ||
gotNew = function (e) {newCount++;}; | ||
this.map.on('editable:vertex:new', gotNew); | ||
var polygon = this.map.editTools.startPolygon(); | ||
assert.equal(newCount, 0); | ||
happen.drawingClick(250, 200); | ||
happen.drawingClick(350, 300); | ||
assert.equal(newCount, 2); | ||
this.map.off('editable:vertex:new', gotNew); | ||
polygon.remove(); | ||
}); | ||
it('should fire editable:vertex:new on middle marker click', function (done) { | ||
var newCount = 0, | ||
gotNew = function (e) {newCount++;}; | ||
var polygon = this.map.editTools.startPolygon(); | ||
happen.drawingClick(500, 500); | ||
happen.drawingClick(400, 400); | ||
assert.equal(newCount, 0); | ||
this.map.on('editable:vertex:new', gotNew); | ||
happen.drag(450, 450, 300, 400, function () { | ||
assert.equal(newCount, 1); | ||
map.off('editable:vertex:new', gotNew); | ||
polygon.remove(); | ||
done(); | ||
}); | ||
}); | ||
it('should not trigger editable:vertex:new when enabling edition', function () { | ||
var newCount = 0, | ||
gotNew = function (e) {newCount++;}; | ||
this.map.on('editable:vertex:new', gotNew); | ||
var layer = L.polygon([p2ll(100, 150), p2ll(150, 200)]).addTo(this.map); | ||
layer.enableEdit(); | ||
assert.equal(newCount, 0); | ||
map.off('editable:vertex:new', gotNew); | ||
layer.remove(); | ||
}); | ||
it('should be possible to cancel editable:drawing:click actions', function () { | ||
@@ -594,0 +634,0 @@ var called = 0, |
@@ -554,2 +554,43 @@ 'use strict'; | ||
it('should fire editable:vertex:new ', function () { | ||
var newCount = 0, | ||
gotNew = function (e) {newCount++;}; | ||
this.map.on('editable:vertex:new', gotNew); | ||
var layer = this.map.editTools.startPolyline(); | ||
happen.drawingClick(450, 450); | ||
happen.drawingClick(400, 400); | ||
assert.equal(newCount, 2); | ||
this.map.off('editable:vertex:new', gotNew); | ||
layer.remove(); | ||
}); | ||
it('should fire editable:vertex:new on middle marker click', function (done) { | ||
var newCount = 0, | ||
gotNew = function (e) {newCount++;}; | ||
var layer = this.map.editTools.startPolyline(); | ||
happen.drawingClick(500, 500); | ||
happen.drawingClick(400, 400); | ||
assert.equal(newCount, 0); | ||
this.map.on('editable:vertex:new', gotNew); | ||
happen.drag(450, 450, 300, 400, function () { | ||
assert.equal(newCount, 1); | ||
map.off('editable:vertex:new', gotNew); | ||
layer.remove(); | ||
done(); | ||
}); | ||
}); | ||
it('should not trigger editable:vertex:new when enabling edition', function () { | ||
var newCount = 0, | ||
gotNew = function (e) {newCount++;}; | ||
this.map.on('editable:vertex:new', gotNew); | ||
var layer = L.polyline([p2ll(100, 150), p2ll(150, 200)]).addTo(this.map); | ||
layer.enableEdit(); | ||
layer.editor.continueForward(); | ||
happen.drawingClick(400, 400); | ||
assert.equal(newCount, 1); | ||
map.off('editable:vertex:new', gotNew); | ||
layer.remove(); | ||
}); | ||
it('should send editable:drawing:click before adding vertex', function () { | ||
@@ -556,0 +597,0 @@ var called = 0, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4834
309201
48