feat(ui): wip transform mode

This commit is contained in:
psychedelicious
2024-07-26 18:28:02 +10:00
parent 2b7e6b44ec
commit 8a4b4ec4fe
13 changed files with 202 additions and 270 deletions

View File

@@ -194,6 +194,7 @@ export const {
allEntitiesDeleted,
clipToBboxChanged,
canvasReset,
toolIsTransformingChanged,
// bbox
bboxChanged,
bboxScaledSizeChanged,

View File

@@ -20,4 +20,7 @@ export const toolReducers = {
toolBufferChanged: (state, action: PayloadAction<Tool | null>) => {
state.tool.selectedBuffer = action.payload;
},
toolIsTransformingChanged: (state, action: PayloadAction<boolean>) => {
state.tool.isTransforming = action.payload;
},
} satisfies SliceCaseReducers<CanvasV2State>;

View File

@@ -464,7 +464,7 @@ export const CA_PROCESSOR_DATA: CAProcessorsData = {
},
};
const zTool = z.enum(['brush', 'eraser', 'move', 'rect', 'view', 'bbox', 'transform']);
const zTool = z.enum(['brush', 'eraser', 'move', 'rect', 'view', 'bbox']);
export type Tool = z.infer<typeof zTool>;
export function isDrawingTool(tool: Tool): tool is 'brush' | 'eraser' | 'rect' {
return tool === 'brush' || tool === 'eraser' || tool === 'rect';
@@ -850,6 +850,7 @@ export type CanvasV2State = {
brush: { width: number };
eraser: { width: number };
fill: RgbaColor;
isTransforming: boolean;
};
settings: {
imageSmoothing: boolean;