@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 14 lines 534 Bytes
Raw
1 interface Size {
2 readonly width: number;
3 readonly height: number;
4 }
5
6 /** Largest frame with the video's aspect ratio that fits the bounds and the inline width cap. */
7 export function fitVideoFrame(video: Size, bounds: Size, maxWidth: number): Size | null {
8 if (video.width <= 0 || video.height <= 0 || bounds.width <= 0 || bounds.height <= 0) {
9 return null;
10 }
11 const ratio = video.width / video.height;
12 const width = Math.min(bounds.width, maxWidth, bounds.height * ratio);
13 return { width, height: width / ratio };
14 }