Skip to content

🎥 Make videos programmatically with React

417 B
Raw Blame
import type {CropRectangle} from 'mediabunny';

export const moveCropRect = ({
	previousRect,
	visibleRect,
	left,
	top,
}: {
	readonly previousRect: CropRectangle;
	readonly visibleRect: CropRectangle;
	readonly left: number;
	readonly top: number;
}): CropRectangle => {
	return {
		...previousRect,
		left: Math.round(left),
		top: Math.round(top),
		width: visibleRect.width,
		height: visibleRect.height,
	};
};