From be1db2a1ec4b46c17deb24de9da0167ebfac8abf Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 10 Apr 2017 11:28:41 +0200 Subject: [PATCH] Ability to remove an object when draw mode is off --- www/whiteboard/main.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/www/whiteboard/main.js b/www/whiteboard/main.js index 7939658f7..21ff6a032 100644 --- a/www/whiteboard/main.js +++ b/www/whiteboard/main.js @@ -155,6 +155,22 @@ define([ }; $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) { if (readOnly && bool) { return; } if (bool) { $controls.show(); }