Close text edition field when "escape" is pressed

This commit is contained in:
Ophir LOJKINE 2019-06-22 21:03:02 +02:00
parent 205a17902b
commit 3151651f45
2 changed files with 3 additions and 2 deletions

View file

@ -58,7 +58,6 @@ Tools.HTML = {
elem.getElementsByClassName("tool-name")[0].textContent = toolName;
elem.getElementsByClassName("tool-icon")[0].textContent = toolIcon;
elem.title =
Tools.i18n.t("Tool") + ": " +
Tools.i18n.t(toolName) + " (" +
Tools.i18n.t("keyboard shortcut") + ": " +
toolShortcut + ")";

View file

@ -100,9 +100,11 @@
}
function textChangeHandler(evt) {
if (evt.which === 13) {
if (evt.which === 13) { // enter
curText.y += 1.5 * curText.size;
return drawCurText();
} else if (evt.which === 27) { // escape
stopEdit();
}
if (performance.now() - curText.lastSending > 100) {
if (curText.sentText !== input.value) {