Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 | 7x 6x 6x 6x | import type { BeMusicRect } from '@be-music/player-skin-sdk';
/** Keeps the monitor height while fitting its width inside the information column. */
export function fitVideoBGARect(rect: BeMusicRect, width: number, height: number, maxWidth: number): BeMusicRect {
if (!(width > 0) || !(height > 0) || !(maxWidth > 0)) return rect;
const w = Math.min(maxWidth, (rect.h * width) / height);
Iif (!Number.isFinite(w) || w === rect.w) return rect;
return { ...rect, x: rect.x + (rect.w - w) / 2, w };
}
|