Fix blockchain scrolling on high refresh-rate devices
This commit is contained in:
parent
4e68498979
commit
059139689d
@ -196,12 +196,14 @@ 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;
|
||||||
|
if (dt > 0) {
|
||||||
this.lastUpdate = now;
|
this.lastUpdate = now;
|
||||||
const velocity = (x - this.lastMouseX) / dt;
|
const velocity = (x - this.lastMouseX) / dt;
|
||||||
this.velocity = (0.8 * this.velocity) + (0.2 * velocity);
|
this.velocity = (0.8 * this.velocity) + (0.2 * velocity);
|
||||||
this.lastMouseX = x;
|
this.lastMouseX = x;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
animateMomentum() {
|
animateMomentum() {
|
||||||
this.lastUpdate = performance.now();
|
this.lastUpdate = performance.now();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user