Ability to remove an object when draw mode is off

pull/1/head
yflory 8 years ago
parent a13261abaa
commit be1db2a1ec

@ -155,6 +155,22 @@ define([
}; };
$toggle.click(toggleDrawMode); $toggle.click(toggleDrawMode);
$(window).on('keyup', function (e) {
if (e.which === 46) {
if (canvas.getActiveObject()) {
canvas.getActiveObject().remove();
}
if (canvas.getActiveGroup()) {
canvas.getActiveGroup()._objects.forEach(function (el) {
el.remove();
});
canvas.discardActiveGroup();
}
canvas.renderAll();
onLocal();
}
});
var setEditable = function (bool) { var setEditable = function (bool) {
if (readOnly && bool) { return; } if (readOnly && bool) { return; }
if (bool) { $controls.show(); } if (bool) { $controls.show(); }

Loading…
Cancel
Save