Download packages/tui/src/util/scroll.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 680 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/tui/src/util/scroll.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/tui/src/util/scroll.ts
-
curl -L -o scroll.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/tui/src/util/scroll.ts
680 Bytes
| import { MacOSScrollAccel, type ScrollAcceleration } from "@opentui/core" | |
| export type ScrollConfig = { | |
| scroll_acceleration?: { enabled?: boolean } | |
| scroll_speed?: number | |
| } | |
| export class CustomSpeedScroll implements ScrollAcceleration { | |
| constructor(private speed: number) {} | |
| tick(_now?: number): number { | |
| return this.speed | |
| } | |
| reset(): void {} | |
| } | |
| export function getScrollAcceleration(tuiConfig?: ScrollConfig): ScrollAcceleration { | |
| if (tuiConfig?.scroll_acceleration?.enabled) { | |
| return new MacOSScrollAccel() | |
| } | |
| if (tuiConfig?.scroll_speed !== undefined) { | |
| return new CustomSpeedScroll(tuiConfig.scroll_speed) | |
| } | |
| return new CustomSpeedScroll(3) | |
| } | |