feat: 优化填充组图层背景命令,支持实时更新和撤销功能,改进填充对象的处理逻辑
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user