move KeyMouse listeners to correct location

pull/48/head
Dimava 4 years ago
parent fe33f51424
commit 0d342ee417

@ -141,8 +141,13 @@ export class InputDistributor {
bindToEvents() {
window.addEventListener("popstate", this.handleBackButton.bind(this), false);
document.addEventListener("backbutton", this.handleBackButton.bind(this), false);
window.addEventListener("keydown", this.handleKeydown.bind(this));
window.addEventListener("keyup", this.handleKeyup.bind(this));
window.addEventListener("keydown", this.handleKeyMouseDown.bind(this));
window.addEventListener("keyup", this.handleKeyMouseUp.bind(this));
window.addEventListener("mousedown", this.handleKeyMouseDown.bind(this));
window.addEventListener("mouseup", this.handleKeyMouseUp.bind(this));
window.addEventListener("blur", this.handleBlur.bind(this));
}
@ -184,7 +189,7 @@ export class InputDistributor {
/**
* @param {KeyboardEvent | MouseEvent} event
*/
handleKeydown(event) {
handleKeyMouseDown(event) {
const keyCode = event instanceof MouseEvent ? event.button + 1 : event.keyCode;
if (
keyCode === 4 || // MB4
@ -224,7 +229,7 @@ export class InputDistributor {
/**
* @param {KeyboardEvent | MouseEvent} event
*/
handleKeyup(event) {
handleKeyMouseUp(event) {
const keyCode = event instanceof MouseEvent ? event.button + 1 : event.keyCode;
this.keysDown.delete(keyCode);

@ -443,7 +443,6 @@ export class Camera extends BasicSerializableObject {
} else if (event.button === 2) {
this.downPreHandler.dispatch(new Vector(event.clientX, event.clientY), enumMouseButton.right);
}
this.root.app.inputMgr.handleKeydown(event);
return false;
}
@ -485,7 +484,6 @@ export class Camera extends BasicSerializableObject {
if (!this.checkPreventDoubleMouse()) {
return;
}
this.root.app.inputMgr.handleKeyup(event);
this.combinedSingleTouchStopHandler(event.clientX, event.clientY);
return false;

Loading…
Cancel
Save