mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-16 23:06:30 +00:00
Fixed adding extra force to the swiping motion
This commit is contained in:
@@ -379,7 +379,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
this._swipeState = {
|
this._swipeState = {
|
||||||
isGestureActive: true,
|
isGestureActive: true,
|
||||||
lastDelta: 0,
|
lastDelta: 0,
|
||||||
@@ -393,14 +392,14 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
const delta = event.delta * 300 + 1;
|
const delta = event.delta * 300;
|
||||||
const stripWidth = document.getElementById('tabbrowser-tabs').getBoundingClientRect().width;
|
const stripWidth = document.getElementById('tabbrowser-tabs').getBoundingClientRect().width;
|
||||||
let translateX = this._swipeState.lastDelta + delta;
|
let translateX = this._swipeState.lastDelta + delta;
|
||||||
// Add a force multiplier as we are translating the strip depending on how close to the edge we are
|
// Add a force multiplier as we are translating the strip depending on how close to the edge we are
|
||||||
let forceMultiplier = Math.min(1, 1 - Math.abs(translateX) / (stripWidth * 4.5)); // 4.5 instead of 4 to add a bit of a buffer
|
let forceMultiplier = Math.min(1, 1 - Math.abs(translateX) / (stripWidth * 4.5)); // 4.5 instead of 4 to add a bit of a buffer
|
||||||
if (forceMultiplier > 0.5) {
|
if (forceMultiplier > 0.5) {
|
||||||
translateX *= forceMultiplier;
|
translateX *= forceMultiplier;
|
||||||
this._swipeState.lastDelta = delta;
|
this._swipeState.lastDelta = delta + (translateX - delta) * 0.5;
|
||||||
} else {
|
} else {
|
||||||
translateX = this._swipeState.lastDelta;
|
translateX = this._swipeState.lastDelta;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user