fix: 优化细节

This commit is contained in:
bighuixiang
2025-07-24 21:37:21 +08:00
parent 46b1c5cd71
commit 3ff5e27db6
10 changed files with 335 additions and 102 deletions

View File

@@ -3,7 +3,7 @@ import { BrushManager } from "./brushes/brushManager";
import { BrushIndicator } from "./BrushIndicator";
import { ToolCommand } from "../commands/ToolCommands";
import { CreateTextCommand } from "../commands/TextCommands";
import { OperationType } from "../utils/layerHelper";
import { findLayerRecursively, OperationType } from "../utils/layerHelper";
import CanvasConfig from "../config/canvasConfig";
import { fabric } from "fabric-with-all";
import { InitLiquifyToolCommand } from "../commands/LiquifyCommands";
@@ -349,6 +349,11 @@ export class ToolManager {
// 保存先前的工具
this.previousTool = this.activeTool.value;
// 取消画布的选中状态
this.canvas?.discardActiveObject();
this.canvasManager?.layerManager?.updateLayersObjectsInteractivity?.();
this.canvas?.renderAll();
// 如果切换到非画笔工具,禁用笔刷指示器
if (!this._shouldShowBrushIndicator(toolId)) {
this._disableBrushIndicator();
@@ -665,7 +670,11 @@ export class ToolManager {
panelDetail.layerStatus = checkResult;
// 获取图层对象
const layer = this.layerManager.getLayerById(activeLayerId);
// const layer = this.layerManager.getLayerById(activeLayerId);
const { layer } = findLayerRecursively(
this.layerManager.layers?.value ?? this.layerManager.layers,
activeLayerId
);
// 检查图层是否为空
if (!checkResult.isEmpty) {
@@ -844,7 +853,12 @@ export class ToolManager {
*/
async _startLiquify(layerId) {
// 获取图层信息
const layer = this.layerManager.getLayerById(layerId);
// const layer = this.layerManager.getLayerById(layerId);
const { layer } = findLayerRecursively(
this.layerManager.layers?.value ?? this.layerManager.layers,
layerId
);
if (!layer) {
Modal.error({
title: "图层错误",
@@ -1122,7 +1136,11 @@ export class ToolManager {
target.type === "textbox")
) {
// 获取对应的图层
const layer = this.layerManager.getLayerById(target.layerId);
// const layer = this.layerManager.getLayerById(target.layerId);
const { layer } = findLayerRecursively(
this.layerManager.layers?.value ?? this.layerManager.layers,
target.layerId
);
if (layer) {
// 显示文本编辑面板
this.showTextEditor(target, layer);