By default esc key deselects current selection. Is there a way to prevent this? In my diagram I need to keep at least one node always selected. Thanks.
The ESC key invokes the CommandHandler.stopCommand.
Here’s how it’s implemented:
public stopCommand() {
const diagram = this.diagram;
const tool = diagram.currentTool;
if (tool instanceof ToolManager && diagram.allowSelect) {
diagram.clearSelection(); // raises ChangingSelection/Finished
}
if (tool !== null) {
tool.doCancel();
}
}
Override that method not to call Diagram.clearSelection.