improve scrolling dampening

This commit is contained in:
hippoz 2021-10-29 16:00:35 +03:00
parent 8192cf901a
commit c573e750eb
No known key found for this signature in database
GPG key ID: 7C52899193467641

View file

@ -8,8 +8,8 @@
<script>
const HOLDING_THRESHOLD_MS = 300;
const SINGLE_CLICK_BUTTON_UP_MS = 5;
const SCROLL_X_THRESHOLD = 50;
const SCROLL_Y_THRESHOLD = 5;
const SCROLL_X_DAMPENING = 0.05;
const SCROLL_Y_DAMPENING = 0.06;
const loggerOfType = (components, type='log') => (...args) => {
let str = '%c';
@ -179,7 +179,7 @@
this.lastMoveY = this.currentMoveY;
// if two touches moved at the same time, assume scrolling intent
if (touches.length === 2) {
this._sendRelativeMouseScroll(deltaX * 0.1, deltaY * 0.5);
this._sendRelativeMouseScroll(deltaX * SCROLL_X_DAMPENING, deltaY * SCROLL_Y_DAMPENING);
} else {
this._sendRelativeMouseMovement(deltaX, deltaY);
}