Skip to content

Commit

Permalink
Delete shape via delete key. Fixes #525.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmartel committed Jul 11, 2018
1 parent 45373c2 commit 7140516
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/tools/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,21 @@ dwv.tool.Draw = function (app, shapeFactoryList)
*/
this.keydown = function(event){
app.onKeydown(event);

// press delete key
if (event.keyCode === 46 && shapeEditor.isActive()) {
// get shape
var shapeGroup = shapeEditor.getShape().getParent();
var shapeDisplayName = dwv.tool.GetShapeDisplayName(
shapeGroup.getChildren( dwv.draw.isNodeNameShape )[0]);
// delete command
var delcmd = new dwv.tool.DeleteGroupCommand(shapeGroup,
shapeDisplayName, drawLayer);
delcmd.onExecute = fireEvent;
delcmd.onUndo = fireEvent;
delcmd.execute();
app.addToUndoStack(delcmd);
}
};

/**
Expand Down

0 comments on commit 7140516

Please sign in to comment.