Skip to content

Commit 545402f

Browse files
committed
fix: closes zen-browser#7274 - Fixed mouses simulating swipes with Forward and Back buttons
1 parent 2b158fd commit 545402f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/zen/workspaces/ZenWorkspaces.mjs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
327327
return;
328328
}
329329

330+
console.log(event);
331+
330332
const direction = this.naturalScroll ? -1 : 1;
331333
// event is forward or back
332334
switch (event.command) {
@@ -472,19 +474,17 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
472474
}
473475

474476
async _handleSwipeEnd(event) {
475-
if (!this.workspaceEnabled || !this._swipeState?.isGestureActive) return;
477+
console.log(event, this._swipeState);
478+
479+
if (!this.workspaceEnabled) return;
476480
event.preventDefault();
477481
event.stopPropagation();
478482
const isRTL = document.documentElement.matches(':-moz-locale-dir(rtl)');
479-
const moveForward = (this._swipeState.direction === 'right') !== isRTL;
483+
const moveForward = (event.direction === SimpleGestureEvent.DIRECTION_RIGHT) !== isRTL;
480484

481-
let rawDirection = moveForward ? 1 : -1;
482-
if (this._swipeState.direction) {
483-
let direction = this.naturalScroll ? -1 : 1;
484-
this.changeWorkspaceShortcut(rawDirection * direction, true);
485-
} else {
486-
this._cancelSwipeAnimation();
487-
}
485+
const rawDirection = moveForward ? 1 : -1;
486+
const direction = this.naturalScroll ? -1 : 1;
487+
this.changeWorkspaceShortcut(rawDirection * direction, true);
488488

489489
// Reset swipe state
490490
this._swipeState = {

0 commit comments

Comments
 (0)