Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Events draw:editstart and draw:editstop added #175

Merged
merged 2 commits into from

2 participants

Benjamin Hell Jacob Toye
Benjamin Hell

Two additional events are being fired upon activation/deactivation of the
edit mode, similarly to draw:drawstart and draw:drawstop. I.e. when a
user clicks on the edit or remove button, draw:editstart is being fired,
and when the user presses "save", draw:editstop is being fired.

With this it becomes possible to e.g. turn off a layer during editing and
switch it back on when editing is finished.

Benjamin Hell added some commits
Benjamin Hell Events draw:editstart and draw:editstop added
Two additional events are being fired upon activation/deactivation of the
edit mode, similarly to `draw:drawstart` and `draw:drawstop`. I.e. when a
user clicks on the edit or remove button, `draw:editstart` is being fired,
and when the user presses "save", `draw:editstop` is being fired.

With this it becomes possible to e.g. turn off a layer during editing and
switch it back on when editing is finished.
bced9dc
Benjamin Hell Documentation update and fixed variable name
Updated README.md documentation to contain the new signals. Fixed
the name of the signal property from LayerType to handler.
3c3d6a8
Jacob Toye
Owner

Thanks :)

Jacob Toye jacobtoye merged commit 652c211 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 15, 2013
  1. Events draw:editstart and draw:editstop added

    Benjamin Hell authored
    Two additional events are being fired upon activation/deactivation of the
    edit mode, similarly to `draw:drawstart` and `draw:drawstop`. I.e. when a
    user clicks on the edit or remove button, `draw:editstart` is being fired,
    and when the user presses "save", `draw:editstop` is being fired.
    
    With this it becomes possible to e.g. turn off a layer during editing and
    switch it back on when editing is finished.
Commits on Aug 16, 2013
  1. Documentation update and fixed variable name

    Benjamin Hell authored
    Updated README.md documentation to contain the new signals. Fixed
    the name of the signal property from LayerType to handler.
This page is out of date. Refresh to see the latest.
16 README.md
View
@@ -128,6 +128,22 @@ Triggered when the user has finshed a particular vector or marker.
| --- | --- | ---
| layerType | String | The type of layer this is. One of: `polyline`, `polygon`, `rectangle`, `circle`, `marker`
+#### draw:editstart
+
+Triggered when the user starts edit mode by clicking the edit or remove tool button.
+
+| Property | Type | Description
+| --- | --- | ---
+| handler | String | The type of edit this is. One of: `edit`, `remove`
+
+#### draw:editstop
+
+Triggered when the user has finshed editing (edit or remove mode) and saves edits.
+
+| Property | Type | Description
+| --- | --- | ---
+| handler | String | The type of edit this is. One of: `edit`, `remove`
+
<a name="options" />
## Advanced options
2  src/edit/handler/EditToolbar.Delete.js
View
@@ -31,6 +31,7 @@ L.EditToolbar.Delete = L.Handler.extend({
.on('layerremove', this._disableLayerDelete, this);
this.fire('enabled', { handler: this.type});
+ this._map.fire('draw:editstart', { handler: this.type });
},
disable: function () {
@@ -43,6 +44,7 @@ L.EditToolbar.Delete = L.Handler.extend({
.off('layerremove', this._disableLayerDelete, this);
this.fire('disabled', { handler: this.type});
+ this._map.fire('draw:editstop', { handler: this.type });
},
addHooks: function () {
4 src/edit/handler/EditToolbar.Edit.js
View
@@ -34,12 +34,14 @@ L.EditToolbar.Edit = L.Handler.extend({
.on('layerremove', this._disableLayerEdit, this);
this.fire('enabled', {handler: this.type});
+ this._map.fire('draw:editstart', { handler: this.type });
},
disable: function () {
if (!this._enabled) { return; }
this.fire('disabled', {handler: this.type});
+ this._map.fire('draw:editstop', { handler: this.type });
this._featureGroup
.off('layeradd', this._enableLayerEdit, this)
@@ -233,4 +235,4 @@ L.EditToolbar.Edit = L.Handler.extend({
_onMouseMove: function (e) {
this._tooltip.updatePosition(e.latlng);
}
-});
+});
Something went wrong with that request. Please try again.