refactor: global keys
This commit is contained in:
parent
49080972b4
commit
103140ee8f
|
@ -90,8 +90,7 @@ export class App extends decorate(class {}) {
|
|||
this.onBlur = this.onBlur.bind(this);
|
||||
this.onFocus = this.onFocus.bind(this);
|
||||
// Global keys.
|
||||
this.onGlobalKeydown = this.onGlobalKeydown.bind(this);
|
||||
window.addEventListener('keydown', this.onGlobalKeydown);
|
||||
this.inputNormalizer.on('keyDown', this.onGlobalKeydown, this);
|
||||
this.pointingAt = [-1, -1];
|
||||
this.pointerMovementHandle = undefined;
|
||||
// Net.
|
||||
|
@ -236,8 +235,8 @@ export class App extends decorate(class {}) {
|
|||
this.isFocused = true;
|
||||
}
|
||||
|
||||
onGlobalKeydown(event) {
|
||||
switch (event.key) {
|
||||
onGlobalKeydown(key) {
|
||||
switch (key) {
|
||||
case 'F2':
|
||||
this.isDebugging = !this.isDebugging;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue
Block a user