Skip to content

Commit

Permalink
Add jerk
Browse files Browse the repository at this point in the history
  • Loading branch information
jassmith committed Aug 1, 2022
1 parent 20c0c01 commit d954adc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/data-editor/use-autoscroll.ts
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import type { GridMouseCellEventArgs } from "../data-grid/data-grid-types";

const maxPxPerMs = 2;
const msToFullSpeed = 3000;
const msToFullSpeed = 1300;

export function useAutoscroll(
scrollDirection: GridMouseCellEventArgs["scrollEdge"] | undefined,
Expand All @@ -23,7 +23,9 @@ export function useAutoscroll(
} else {
const step = curTime - lastTime;
speedScalar.current = Math.min(1, speedScalar.current + step / msToFullSpeed);
const motion = speedScalar.current * step * maxPxPerMs;
const motion = speedScalar.current ** 1.618 * step * maxPxPerMs;
// eslint-disable-next-line no-console
console.log(speedScalar.current ** 3);
scrollRef.current?.scrollBy(xDir * motion, yDir * motion);
lastTime = curTime;
}
Expand Down

0 comments on commit d954adc

Please sign in to comment.