部件选取

This commit is contained in:
李志鹏
2026-01-26 16:16:40 +08:00
parent ba49b02ebe
commit 9cecbdcf9b
11 changed files with 245 additions and 144 deletions

View File

@@ -178,7 +178,7 @@ export class CanvasManager {
this.canvas.onBrushImageConverted = async (fabricImage) => {
const activeTool = this.toolManager?.activeTool?.value;
if(activeTool === OperationType.PART_BRUSH){
this.partManager?.addPartImage(fabricImage);
this.partManager?.addDrawPartImage(fabricImage);
}else{
await this.addImageToLayer({ fabricImage, targetLayerId: null });
}
@@ -203,6 +203,10 @@ export class CanvasManager {
console.log("擦除完成", e.targets);
// 可以在这里保存状态到命令管理器
const affectedObjects = e.targets || [];
const activeTool = this.toolManager?.activeTool?.value;
if(activeTool === OperationType.PART_ERASER){
return this.partManager?.onErasingEnd(affectedObjects);
}
const command = this.eraserStateManager.endErasing(affectedObjects);
if (command && this.commandManager) {
await this.commandManager?.executeCommand?.(command);