Fix blockchain scrolling on high refresh-rate devices

This commit is contained in:
Mononaut 2023-03-03 23:39:01 -06:00
parent 4e68498979
commit 059139689d
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -196,11 +196,13 @@ export class StartComponent implements OnInit, OnDestroy {
updateVelocity(x: number) { updateVelocity(x: number) {
const now = performance.now(); const now = performance.now();
const dt = now - this.lastUpdate; let dt = now - this.lastUpdate;
this.lastUpdate = now; if (dt > 0) {
const velocity = (x - this.lastMouseX) / dt; this.lastUpdate = now;
this.velocity = (0.8 * this.velocity) + (0.2 * velocity); const velocity = (x - this.lastMouseX) / dt;
this.lastMouseX = x; this.velocity = (0.8 * this.velocity) + (0.2 * velocity);
this.lastMouseX = x;
}
} }
animateMomentum() { animateMomentum() {