feat: image cropping (#8613)

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
Ryan Di 2024-10-22 04:26:52 +08:00 committed by GitHub
parent eb09b48ae6
commit e957c8e9ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 2199 additions and 92 deletions

View file

@ -176,6 +176,8 @@ export type StaticCanvasAppState = Readonly<
gridStep: AppState["gridStep"];
frameRendering: AppState["frameRendering"];
currentHoveredFontFamily: AppState["currentHoveredFontFamily"];
// Cropping
croppingElementId: AppState["croppingElementId"];
}
>;
@ -198,6 +200,9 @@ export type InteractiveCanvasAppState = Readonly<
snapLines: AppState["snapLines"];
zenModeEnabled: AppState["zenModeEnabled"];
editingTextElement: AppState["editingTextElement"];
// Cropping
isCropping: AppState["isCropping"];
croppingElementId: AppState["croppingElementId"];
// Search matches
searchMatches: AppState["searchMatches"];
}
@ -219,6 +224,7 @@ export type ObservedElementsAppState = {
editingLinearElementId: LinearElementEditor["elementId"] | null;
// Right now it's coupled to `editingLinearElement`, ideally it should not be really needed as we already have selectedElementIds & editingLinearElementId
selectedLinearElementId: LinearElementEditor["elementId"] | null;
croppingElementId: AppState["croppingElementId"];
};
export interface AppState {
@ -386,6 +392,11 @@ export interface AppState {
userToFollow: UserToFollow | null;
/** the socket ids of the users following the current user */
followedBy: Set<SocketId>;
/** image cropping */
isCropping: boolean;
croppingElementId: ExcalidrawElement["id"] | null;
searchMatches: readonly SearchMatch[];
}