Skip to content

Commit

Permalink
Filtered right click events
Browse files Browse the repository at this point in the history
Fixes #6
  • Loading branch information
neonfuz committed Aug 8, 2022
1 parent 9a7642f commit 1c51b16
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib/knobdrag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ function preventDefault(event: Event) {
}

function pointerlock(elem: HTMLElement) {
function enterLock() {
elem.requestPointerLock();
function enterLock(event: MouseEvent) {
if (event.button !== 2)
elem.requestPointerLock();
}
function exitLock() {
document.exitPointerLock();
Expand All @@ -101,7 +102,8 @@ function pointerlock(elem: HTMLElement) {

function pointercapture(elem: HTMLElement) {
function pointerDown(event: PointerEvent) {
elem.setPointerCapture(event.pointerId);
if (event.button !== 2)
elem.setPointerCapture(event.pointerId);
}
elem.addEventListener('pointerdown', pointerDown);
elem.addEventListener('touchmove', preventDefault);
Expand Down

0 comments on commit 1c51b16

Please sign in to comment.