feat(transform): add transform session commands
This commit is contained in:
@@ -12,6 +12,7 @@ export const initialEditorState: EditorState = {
|
||||
layerIds: [],
|
||||
},
|
||||
tools: initialToolState,
|
||||
transformSession: undefined,
|
||||
};
|
||||
|
||||
export function createInitialAppState(name = "Untitled"): AppState {
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { ImageDocument } from "@core/document";
|
||||
import type { Angle, Size, Vec2D } from "@core/geometry";
|
||||
import type { ArtboardId, LayerId } from "@core/id";
|
||||
import type { ToolState } from "./tools";
|
||||
import type { TransformSession } from "./transform";
|
||||
|
||||
export type ViewportState = {
|
||||
center: Vec2D;
|
||||
@@ -19,6 +20,7 @@ export type EditorState = {
|
||||
viewport: ViewportState;
|
||||
selection: SelectionState;
|
||||
tools: ToolState;
|
||||
transformSession?: TransformSession;
|
||||
};
|
||||
|
||||
export type AppState = {
|
||||
|
||||
16
editor/transform.ts
Normal file
16
editor/transform.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { Rect, Vec2D } from "@core/geometry";
|
||||
import type { ArtboardId } from "@core/id";
|
||||
|
||||
export type TransformHandle = "body" | "n" | "ne" | "e" | "se" | "s" | "sw" | "w" | "nw";
|
||||
|
||||
export type TransformTarget = {
|
||||
type: "artboard";
|
||||
id: ArtboardId;
|
||||
};
|
||||
|
||||
export type TransformSession = {
|
||||
target: TransformTarget;
|
||||
handle: TransformHandle;
|
||||
startPoint: Vec2D;
|
||||
initialBounds: Rect;
|
||||
};
|
||||
Reference in New Issue
Block a user