feat: 实时更新背景色+选取剪切+选取删除初步开发完成
This commit is contained in:
@@ -130,13 +130,15 @@ export class UpdateBackgroundCommand extends Command {
|
||||
});
|
||||
this.canvas = options.canvas;
|
||||
this.layers = options.layers;
|
||||
this.canvasManager = options.canvasManager;
|
||||
this.backgroundColorValue = options.backgroundColorValue; // 使用.value获取实际值
|
||||
this.backgroundColor = options.backgroundColor; //
|
||||
this.historyManager = options.historyManager;
|
||||
this.oldColor = options.oldColor; // 旧颜色,用于撤销
|
||||
|
||||
// 查找背景图层
|
||||
this.bgLayer = this.layers.value.find((layer) => layer.isBackground);
|
||||
this.oldBackgroundColor = this.bgLayer.backgroundColor;
|
||||
this.oldBackgroundColor = this.oldColor;
|
||||
this.backgroundObject = findObjectById(
|
||||
this.canvas,
|
||||
this.bgLayer.fabricObject.id
|
||||
@@ -159,6 +161,11 @@ export class UpdateBackgroundCommand extends Command {
|
||||
this.canvas.renderAll();
|
||||
}
|
||||
this.backgroundColorValue.value = this.backgroundColor; // 设置背景颜色
|
||||
|
||||
// 生成缩略图
|
||||
this.canvasManager?.thumbnailManager?.generateLayerThumbnail?.(
|
||||
this.bgLayer.id
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -177,6 +184,12 @@ export class UpdateBackgroundCommand extends Command {
|
||||
this.canvas.renderAll();
|
||||
}
|
||||
this.backgroundColorValue.value = this.oldBackgroundColor; // 恢复背景颜色
|
||||
|
||||
// 生成缩略图
|
||||
this.canvasManager?.thumbnailManager?.generateLayerThumbnail?.(
|
||||
this.bgLayer.id
|
||||
);
|
||||
// 如果有旧颜色,恢复到旧颜色
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user