feat: 优化填充组图层背景命令,支持实时更新和撤销功能,改进填充对象的处理逻辑

This commit is contained in:
bighuixiang
2025-07-16 11:35:52 +08:00
parent e31a619bd6
commit 5f29e488ed
9 changed files with 372 additions and 201 deletions

View File

@@ -1,3 +1,4 @@
import { FillGroupLayerBackgroundCommand } from "../commands/FillGroupLayerBackgroundCommand";
import { FillLayerBackgroundCommand } from "../commands/FillLayerBackgroundCommand";
export class BackgroundFillManager {
@@ -12,15 +13,21 @@ export class BackgroundFillManager {
* 填充指定图层背景
* @param {string} layerId 图层ID
* @param {string} fillColor 填充颜色
* @param {boolean} undoable 是否可撤销
* @returns {Promise<void>}
*/
async fillLayerBackground(layerId, fillColor) {
const command = new FillLayerBackgroundCommand({
async fillLayerBackground(layerId, fillColor, undoable) {
const command = new FillGroupLayerBackgroundCommand({
canvas: this.canvas,
layers: this.layers,
layerId,
fillColor,
canvasManager: this.canvasManager,
// 是否实时更新
isRetimeUpdate: !undoable,
});
command.undoable = undoable;
if (this.commandManager) {
await this.commandManager.execute(command);
} else {