feat: 优化跨层级移动和套索抠图命令,支持异步执行,改进画布刷新逻辑,新增背景裁剪选项
This commit is contained in:
@@ -2033,8 +2033,12 @@ export class LayerObjectsToGroupCommand extends Command {
|
||||
|
||||
const allObjects = [...originalObjects, ...newObjects];
|
||||
|
||||
const clipPath = allObjects?.[0]?.clipPath || null;
|
||||
// 从画布中移除所有要组合的对象
|
||||
allObjects.forEach((obj) => {
|
||||
obj.clipPath = null;
|
||||
obj.dirty = true; // 标记为脏对象
|
||||
// obj.setCoords();
|
||||
obj.opacity = 1;
|
||||
removeCanvasObjectByObject(this.canvas, obj);
|
||||
});
|
||||
@@ -2052,6 +2056,10 @@ export class LayerObjectsToGroupCommand extends Command {
|
||||
// 添加组对象到画布
|
||||
this.canvas.add(groupObject);
|
||||
|
||||
groupObject.clipPath = clipPath; // 恢复剪切路径
|
||||
groupObject.dirty = true; // 标记为脏对象
|
||||
groupObject.setCoords();
|
||||
|
||||
// 更新图层的对象列表
|
||||
// this.activeLayer.fabricObjects = [groupObject];
|
||||
this.activeLayer.fabricObjects = [
|
||||
|
||||
Reference in New Issue
Block a user