feat: 裁剪组裁剪跟随选择组移动

This commit is contained in:
bighuixiang
2025-07-14 01:00:23 +08:00
parent 96e13cb22a
commit 24e9ba8ae5
80 changed files with 2052 additions and 4292 deletions

View File

@@ -110,9 +110,7 @@ export class AddToSelectionCommand extends Command {
}
// 添加到选区
const result = await this.selectionManager.addToSelection(
this.newSelection
);
const result = await this.selectionManager.addToSelection(this.newSelection);
return result;
}
@@ -155,9 +153,7 @@ export class RemoveFromSelectionCommand extends Command {
}
// 从选区中移除
const result = await this.selectionManager.removeFromSelection(
this.removeSelection
);
const result = await this.selectionManager.removeFromSelection(this.removeSelection);
return result;
}
@@ -203,9 +199,7 @@ export class FeatherSelectionCommand extends Command {
}
// 应用羽化
const result = await this.selectionManager.featherSelection(
this.featherAmount
);
const result = await this.selectionManager.featherSelection(this.featherAmount);
return result;
}
@@ -347,8 +341,7 @@ export class CopySelectionToNewLayerCommand extends CompositeCommand {
}
// 确定源图层
const sourceId =
this.sourceLayerId || this.layerManager.getActiveLayerId();
const sourceId = this.sourceLayerId || this.layerManager.getActiveLayerId();
const sourceLayer = this.layerManager.getLayerById(sourceId);
if (!sourceLayer || !sourceLayer.fabricObjects) {
console.error("无法复制选区:源图层无效或为空");
@@ -356,10 +349,7 @@ export class CopySelectionToNewLayerCommand extends CompositeCommand {
}
// 创建新图层
this.newLayerId = await this.layerManager.createLayer(
this.newLayerName,
LayerType.EMPTY
);
this.newLayerId = await this.layerManager.createLayer(this.newLayerName, LayerType.EMPTY);
// 获取选区内的对象
const objectsToCopy = sourceLayer.fabricObjects.filter((obj) => {