Событие спасения листовок
L.EditToolbar.include({
getActions: function (handler) {
var actions = [
{
title: L.drawLocal.edit.toolbar.actions.save.title,
text: L.drawLocal.edit.toolbar.actions.save.text,
callback: this._save,
context: this
},
{
title: L.drawLocal.edit.toolbar.actions.cancel.title,
text: L.drawLocal.edit.toolbar.actions.cancel.text,
// callback: this.disable, // --- original
callback: this._cancel, // --- changed
context: this
}
];
if (handler.removeAllLayers) {
actions.push({
title: L.drawLocal.edit.toolbar.actions.clearAll.title,
text: L.drawLocal.edit.toolbar.actions.clearAll.text,
callback: this._clearAllLayers,
context: this
});
}
return actions;
},
// --- new -----------------
_cancel: function() {
this.disable();
this._map.fire('draw:editcancel');
}
});
function processCancel(e) {
console.log('draw canceled');
}
map.on('draw:editcancel', processCancel);
Scorpio King