6 lines
232 B
TypeScript
6 lines
232 B
TypeScript
const PREVIEW_WIDTHS = [640, 960, 1280, 1600, 2048, 2600, 3200, 4096];
|
|
|
|
export function canvasImagePreviewWidth(width: number, maxWidth: number) {
|
|
return Math.min(maxWidth, PREVIEW_WIDTHS.find(value => value >= width) || 4096);
|
|
}
|