replace MouseEvent.which with MouseEvent.button

This commit is contained in:
Dimava 2020-05-30 10:54:53 +03:00
parent 88a1c733bd
commit da94d5264a
2 changed files with 6 additions and 6 deletions

View File

@ -311,7 +311,7 @@ export class ClickDetector {
const position = /** @type {typeof ClickDetector} */ (this.constructor).extractPointerPosition(event); const position = /** @type {typeof ClickDetector} */ (this.constructor).extractPointerPosition(event);
if (event instanceof MouseEvent) { if (event instanceof MouseEvent) {
const isRightClick = event.which == 3; const isRightClick = event.button === 2;
if (isRightClick) { if (isRightClick) {
// Ignore right clicks // Ignore right clicks
this.rightClick.dispatch(position, event); this.rightClick.dispatch(position, event);
@ -384,7 +384,7 @@ export class ClickDetector {
} }
if (event instanceof MouseEvent) { if (event instanceof MouseEvent) {
const isRightClick = event.which == 3; const isRightClick = event.button === 2;
if (isRightClick) { if (isRightClick) {
return; return;
} }

View File

@ -436,11 +436,11 @@ export class Camera extends BasicSerializableObject {
} }
this.touchPostMoveVelocity = new Vector(0, 0); this.touchPostMoveVelocity = new Vector(0, 0);
if (event.which === 1) { if (event.button === 0) {
this.combinedSingleTouchStartHandler(event.clientX, event.clientY); this.combinedSingleTouchStartHandler(event.clientX, event.clientY);
} else if (event.which === 2) { } else if (event.button === 1) {
this.downPreHandler.dispatch(new Vector(event.clientX, event.clientY), enumMouseButton.middle); this.downPreHandler.dispatch(new Vector(event.clientX, event.clientY), enumMouseButton.middle);
} else if (event.which === 3) { } else if (event.button === 2) {
this.downPreHandler.dispatch(new Vector(event.clientX, event.clientY), enumMouseButton.right); this.downPreHandler.dispatch(new Vector(event.clientX, event.clientY), enumMouseButton.right);
} }
return false; return false;
@ -460,7 +460,7 @@ export class Camera extends BasicSerializableObject {
return; return;
} }
if (event.which === 1) { if (event.button === 0) {
this.combinedSingleTouchMoveHandler(event.clientX, event.clientY); this.combinedSingleTouchMoveHandler(event.clientX, event.clientY);
} }