选择工具开发一半, 修改新建图层顺序名称
This commit is contained in:
@@ -34,6 +34,7 @@ import LayersPanel from "./components/LayersPanel/LayersPanel.vue";
|
||||
import BrushControlPanel from "./components/BrushControlPanel.vue";
|
||||
import TextEditorPanel from "./components/TextEditorPanel.vue"; // 引入文本编辑面板
|
||||
import LiquifyPanel from "./components/LiquifyPanel.vue"; // 引入液化编辑面板
|
||||
import SelectMenuPanel from "./components/SelectMenuPanel.vue"; // 引入选择工具菜单组件
|
||||
import SelectionPanel from "./components/SelectionPanel.vue"; // 引入选区面板
|
||||
import { LayerType, OperationType } from "./utils/layerHelper.js";
|
||||
import { ToolManager } from "./managers/ToolManager.js";
|
||||
@@ -619,12 +620,22 @@ function updateCanvasSize() {
|
||||
function updateCanvasColor() {
|
||||
canvasManager.setCanvasColor(canvasColor.value);
|
||||
}
|
||||
|
||||
function createLayerName(){
|
||||
const layer = t("Canvas.layer")
|
||||
// 检查图层名称是否已存在
|
||||
let layerIndex = 1;
|
||||
let layerName = `${layer + " " + layerIndex}`;
|
||||
while (layerManager.getLayerByName(layerName)) {
|
||||
layerIndex++;
|
||||
layerName = `${layer} ${layerIndex}`;
|
||||
}
|
||||
return layerName;
|
||||
}
|
||||
async function addLayer() {
|
||||
await layerManager.createLayer(t("Canvas.EmptyLayer"));
|
||||
await layerManager.createLayer(createLayerName());
|
||||
}
|
||||
async function addTopLayer() {
|
||||
await layerManager.createLayer(t("Canvas.EmptyLayer"), LayerType.EMPTY, {
|
||||
await layerManager.createLayer(createLayerName(), LayerType.EMPTY, {
|
||||
insertTop: true,
|
||||
});
|
||||
}
|
||||
@@ -1173,6 +1184,17 @@ defineExpose({
|
||||
:activeTool="activeTool"
|
||||
/>
|
||||
|
||||
<!-- 选择工具菜单组件 -->
|
||||
<!-- <SelectMenuPanel
|
||||
v-if="canvasManagerLoaded && !enabledRedGreenMode"
|
||||
:canvas="canvasManager && canvasManager.canvas"
|
||||
:commandManager="commandManager"
|
||||
:selectionManager="selectionManager"
|
||||
:layerManager="layerManager"
|
||||
:toolManager="toolManager"
|
||||
:activeTool="activeTool"
|
||||
/> -->
|
||||
|
||||
<div class="zoom-info">
|
||||
{{ t("Canvas.Scale") }}: {{ currentZoom }}%
|
||||
<button class="reset-zoom" @click="resetZoom">
|
||||
|
||||
Reference in New Issue
Block a user