mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-19 05:33:11 +08:00
Threshold diagonal swipe movements, reduce accidental swipe-to-archive #690
This commit is contained in:
parent
8a4e94b5f8
commit
4351084fe8
1 changed files with 6 additions and 1 deletions
|
@ -140,11 +140,16 @@ export default class SwipeContainer extends React.Component<
|
|||
return this.isEnabled;
|
||||
};
|
||||
|
||||
_onWheel = e => {
|
||||
_onWheel = (e: React.WheelEvent<HTMLDivElement>) => {
|
||||
// Require that the wheel direction has a greater X component than Y component
|
||||
const ratio = Math.abs(e.deltaX) / (Math.abs(e.deltaY) || 1);
|
||||
if (this.phase !== Phase.GestureConfirmed && ratio < 1.3) return;
|
||||
|
||||
let velocity = e.deltaX / 3;
|
||||
if (SwipeInverted) {
|
||||
velocity = -velocity;
|
||||
}
|
||||
|
||||
this._onDragWithVelocity(velocity);
|
||||
|
||||
if (this.phase === Phase.GestureConfirmed) {
|
||||
|
|
Loading…
Reference in a new issue