Skip to content

Free open-source image editor for the browser

407 B
Raw Blame
import type { EditorDocument } from "@/core/document";
import { type ImageFrame, validateFrame } from "@/core/image/frame";

/** Replaces the crop, rotation, flips, and perspective as one edit, respecting an open history group; the frame is copied. */
export function applyCrop(document: EditorDocument, frame: ImageFrame) {
  document.edit({ ...document.scene.getState(), frame: validateFrame(frame) });
}