summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2018-11-09 13:34:01 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2018-11-09 13:37:43 +0100
commitd5ba38869897f7904edf6f6f57dd1ce17eff5368 (patch)
tree616468e105662cbad942e1a5b32b277f95655e55
parent453a9391ccf1ab0c7a6869c44664bfcdd1b68fa1 (diff)
downloadrpgedit-d5ba38869897f7904edf6f6f57dd1ce17eff5368.tar
rpgedit-d5ba38869897f7904edf6f6f57dd1ce17eff5368.zip
view: inputhandler: release all keys when focus is lost
-rw-r--r--src/view/input/inputhandler.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/view/input/inputhandler.ts b/src/view/input/inputhandler.ts
index 22fdc28..17abfe6 100644
--- a/src/view/input/inputhandler.ts
+++ b/src/view/input/inputhandler.ts
@@ -31,6 +31,11 @@ export class InputHandler extends Listenable<[string, boolean]> {
this.keys.delete(ev.code);
this.runListeners(ev.code, false);
});
+
+ window.addEventListener('blur', () => {
+ this.keys.clear();
+ this.runListeners('', false);
+ });
}
public has(key: string): boolean {