Skip to content

Commit

Permalink
Add withShortcuts feature to draw, fixes #1579
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmartel committed Dec 19, 2023
1 parent 4145d44 commit 7423a5a
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 @@ -207,6 +207,13 @@ export class Draw {
*/
#withScroll = true;

/**
* With shortcuts flag.
*
* @type {boolean}
*/
#withShortcuts = true;

/**
* Auto shape colour: will use defaults colours and
* vary them according to the layer.
Expand Down Expand Up @@ -500,6 +507,11 @@ export class Draw {
this.#app.onKeydown(event);
}

// escape if shortcuts are deactivated
if (!this.#withShortcuts) {
return;
}

// press delete or backspace key
if ((event.key === 'Delete' ||
event.key === 'Backspace') &&
Expand Down Expand Up @@ -1076,6 +1088,9 @@ export class Draw {
if (typeof features.withScroll !== 'undefined') {
this.#withScroll = features.withScroll;
}
if (typeof features.withShortcuts !== 'undefined') {
this.#withShortcuts = features.withShortcuts;
}
}

/**
Expand Down

0 comments on commit 7423a5a

Please sign in to comment.