feat: 优化选区编辑+修复部分bug

This commit is contained in:
bighuixiang
2025-06-30 18:05:20 +08:00
parent 4a95f27966
commit 2e20b9c3c1
5 changed files with 208 additions and 75 deletions

View File

@@ -156,11 +156,18 @@ export class LassoCutoutCommand extends CompositeCommand {
selectLayer.fabricObjects = [
this.fabricImage.toObject("id", "layerId", "layerName", "parentId"),
];
this.groupLayer.clippingMask = this.fabricImage.toObject(
"id",
"layerId",
"layerName",
"parentId"
); // 设置组图层的fabricObject为遮罩图像
this.groupLayer.children.push(selectLayer);
// 插入新组图层
this.layerManager.layers.value.splice(topLayerIndex, 1, this.groupLayer);
this.layerManager.updateLayersObjectsInteractivity();
await this.layerManager.updateLayersObjectsInteractivity();
this.canvas.discardActiveObject();
this.canvas.setActiveObject(this.fabricImage);
this.canvas.renderAll();