画布填充颜色不能更改和撤回问题

This commit is contained in:
赛义德
2025-10-28 14:02:20 +08:00
parent 41f9293957
commit 8ca4c9bad3
2 changed files with 44 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
import { generateId, optimizeCanvasRendering } from "../utils/helper";
import { generateId, optimizeCanvasRendering, getLayerObjectsZIndex } from "../utils/helper";
import { createLayer, LayerType, OperationType } from "../utils/layerHelper";
import { Command } from "./Command";
import i18n from "@/lang/index.ts";
@@ -536,6 +536,12 @@ export class CreateTextCommand extends Command {
if (this.textObject && this.canvas) {
this.canvas.remove(this.textObject);
}
const layerObjects = getLayerObjectsZIndex(this.canvas, this.layerId);
layerObjects.forEach((obj) => {
if (obj.id === this.textObject?.id) {
this.canvas.remove(obj.object);
}
});
// 智能移除创建的图层
if (this.layerId && this.layerManager) {