feat: 添加对图层操作的支持,优化图层粘贴和变换命令,增强组图层遮罩位置更新逻辑

This commit is contained in:
bighuixiang
2025-07-16 18:08:20 +08:00
parent 5f29e488ed
commit 26581b234a
8 changed files with 409 additions and 164 deletions

View File

@@ -33,7 +33,7 @@ import LiquifyPanel from "./components/LiquifyPanel.vue"; // 引入液化编辑
import SelectionPanel from "./components/SelectionPanel.vue"; // 引入选区面板
import { LayerType, OperationType } from "./utils/layerHelper.js";
import { ToolManager } from "./managers/toolManager.js";
import { fabric } from "fabric-with-all";
// import { fabric } from "fabric-with-all";
import { uploadImageAndCreateLayer, loadImageUrlToLayer, loadImage } from "./utils/imageHelper.js";
// import MinimapPanel from "./components/MinimapPanel.vue";
const KeyboardShortcutHelp = defineAsyncComponent(
@@ -124,6 +124,7 @@ provide("isShowLayerPanel", isShowLayerPanel); // 提供红绿图模式状态给
const layers = ref([]);
const activeLayerId = ref(null);
const activeElementId = ref(null);
const lastSelectLayerId = ref(null); // 最后选择的图层ID
// 当前选择的工具
const activeTool = ref(CanvasConfig.defaultTool); // 默认工具
@@ -199,6 +200,7 @@ onMounted(async () => {
// backgroundColor: canvasColor.value,
currentZoom,
layers,
lastSelectLayerId,
canvasWidth,
canvasHeight,
canvasColor,
@@ -275,6 +277,8 @@ onMounted(async () => {
provide("liquifyManager", () => liquifyManager); // 提供液化管理器
provide("texturePresetManager", texturePresetManager); // 提供纹理预设管理器
provide("layers", layers); // 提供图层数据
provide("lastSelectLayerId", lastSelectLayerId); // 提供最后选择的图层ID
// 初始化网格设置
// toggleGridVisibility(gridEnabled.value);