canvas语言适配
This commit is contained in:
@@ -281,7 +281,7 @@ onMounted(() => {
|
|||||||
" -->
|
" -->
|
||||||
<div class="canvas-settings" v-if="!props.enabledRedGreenMode">
|
<div class="canvas-settings" v-if="!props.enabledRedGreenMode">
|
||||||
<div class="setting-group">
|
<div class="setting-group">
|
||||||
<span class="setting-label">{{ $t("宽度") }}</span>
|
<span class="setting-label">{{ $t("Canvas.width") }}</span>
|
||||||
<a-input-number
|
<a-input-number
|
||||||
:value="canvasWidth"
|
:value="canvasWidth"
|
||||||
class="setting-input"
|
class="setting-input"
|
||||||
@@ -297,7 +297,7 @@ onMounted(() => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-group">
|
<div class="setting-group">
|
||||||
<span class="setting-label">{{ $t("高度") }}</span>
|
<span class="setting-label">{{ $t("Canvas.height") }}</span>
|
||||||
<a-input-number
|
<a-input-number
|
||||||
:value="canvasHeight"
|
:value="canvasHeight"
|
||||||
class="setting-input"
|
class="setting-input"
|
||||||
@@ -313,7 +313,7 @@ onMounted(() => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-group">
|
<div class="setting-group">
|
||||||
<span class="setting-label">{{ $t("颜色") }}</span>
|
<span class="setting-label">{{ $t("Canvas.color") }}</span>
|
||||||
<div class="color-picker-wrapper">
|
<div class="color-picker-wrapper">
|
||||||
<input
|
<input
|
||||||
type="color"
|
type="color"
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, inject, onMounted } from "vue";
|
import { ref, inject, onMounted } from "vue";
|
||||||
import { Skeleton } from "ant-design-vue";
|
import { Skeleton } from "ant-design-vue";
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
const {t} = useI18n()
|
||||||
|
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const shortcuts = ref([]);
|
const shortcuts = ref([]);
|
||||||
@@ -44,17 +46,17 @@ function convertShortcuts(managerShortcuts) {
|
|||||||
|
|
||||||
// 基本的Action到显示名称的映射
|
// 基本的Action到显示名称的映射
|
||||||
const actionDisplayMap = {
|
const actionDisplayMap = {
|
||||||
undo: "撤销",
|
undo: t('Canvas.Undo'),
|
||||||
redo: "重做",
|
redo: t('Canvas.Redo'),
|
||||||
delete: "删除选中元素",
|
delete: t('Canvas.DeleteSelectedElement'),
|
||||||
selectAll: "全选",
|
selectAll: "全选",
|
||||||
copy: "复制",
|
copy: t('Canvas.Copy'),
|
||||||
paste: "粘贴",
|
paste: t('Canvas.Pase'),
|
||||||
cut: "剪切",
|
cut: t('Canvas.Cut'),
|
||||||
save: "保存",
|
save: "保存",
|
||||||
selectTool: "选择工具",
|
selectTool: "选择工具",
|
||||||
increaseBrushSize: "增加笔触大小",
|
increaseBrushSize: t('Canvas.DecreaseBrush'),
|
||||||
decreaseBrushSize: "减小笔触大小",
|
decreaseBrushSize: t('Canvas.IncreaseBrush'),
|
||||||
toggleTempTool: "临时切换工具",
|
toggleTempTool: "临时切换工具",
|
||||||
// newLayer: "新建图层",
|
// newLayer: "新建图层",
|
||||||
// groupLayers: "组合图层",
|
// groupLayers: "组合图层",
|
||||||
@@ -64,15 +66,15 @@ function convertShortcuts(managerShortcuts) {
|
|||||||
|
|
||||||
// 工具ID到显示名称的映射
|
// 工具ID到显示名称的映射
|
||||||
const toolDisplayMap = {
|
const toolDisplayMap = {
|
||||||
select: "选择模式",
|
select: t('Canvas.SelectionMode'),
|
||||||
draw: "绘画模式",
|
draw: t('Canvas.PaintingMode'),
|
||||||
eraser: "橡皮擦模式",
|
eraser: t('Canvas.EraserMode'),
|
||||||
// eyedropper: "吸色工具",
|
// eyedropper: t('Canvas.Cut'),
|
||||||
pan: "移动画布",
|
pan: '移动画布',
|
||||||
lasso: "套索工具",
|
lasso: t('Canvas.LassoTool'),
|
||||||
// area_custom: "自由选区工具",
|
// area_custom: t('Canvas.Cut'),
|
||||||
// wave: "波浪工具",
|
// wave: t('Canvas.Cut'),
|
||||||
liquify: "液化工具",
|
liquify: t('Canvas.LiquifyTool'),
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理每个快捷键
|
// 处理每个快捷键
|
||||||
@@ -95,9 +97,9 @@ function convertShortcuts(managerShortcuts) {
|
|||||||
|
|
||||||
// 添加一些组件特定的快捷键
|
// 添加一些组件特定的快捷键
|
||||||
result.push({
|
result.push({
|
||||||
action: "缩放画布",
|
action: t('Canvas.ZoomCanvas'),
|
||||||
windows: "鼠标滚轮",
|
windows: t('Canvas.MouseWheel'),
|
||||||
mac: "鼠标滚轮 或 触控板缩放手势",
|
mac: t('Canvas.MacZoomCanvas'),
|
||||||
touch: "双指捏合",
|
touch: "双指捏合",
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -268,11 +270,11 @@ function getShortcutsByCategory(category) {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="keyboard-shortcut-help">
|
<div class="keyboard-shortcut-help">
|
||||||
<h2>键盘快捷键 & 操作指南</h2>
|
<h2>{{ $t('Canvas.KeyboardShortcutsOperationGuide') }}</h2>
|
||||||
|
|
||||||
<Skeleton active :loading="loading">
|
<Skeleton active :loading="loading">
|
||||||
<div class="platform-info">
|
<div class="platform-info">
|
||||||
检测到的平台:
|
{{$t('Canvas.TheDetectedPlatform')}}:
|
||||||
<span v-if="platform.isMac">MacOS</span>
|
<span v-if="platform.isMac">MacOS</span>
|
||||||
<span v-else-if="platform.isWindows">Windows</span>
|
<span v-else-if="platform.isWindows">Windows</span>
|
||||||
<span v-else-if="platform.isIPad">iPad</span>
|
<span v-else-if="platform.isIPad">iPad</span>
|
||||||
@@ -283,12 +285,12 @@ function getShortcutsByCategory(category) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="shortcuts-category">
|
<div class="shortcuts-category">
|
||||||
<h3>基本操作</h3>
|
<h3> {{$t('Canvas.BasicOperations')}}</h3>
|
||||||
<table class="shortcuts-table">
|
<table class="shortcuts-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>操作</th>
|
<th>{{$t('Canvas.BasicOperations')}}</th>
|
||||||
<th>快捷键/手势</th>
|
<th>{{$t('Canvas.ShortcutGesture')}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -301,12 +303,12 @@ function getShortcutsByCategory(category) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="shortcuts-category">
|
<div class="shortcuts-category">
|
||||||
<h3>视图操作</h3>
|
<h3>{{ $t('Canvas.viewOperations') }}</h3>
|
||||||
<table class="shortcuts-table">
|
<table class="shortcuts-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>操作</th>
|
<th>{{ $t('Canvas.Operation') }}</th>
|
||||||
<th>快捷键/手势</th>
|
<th>{{ $t('Canvas.ShortcutGesture') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -319,12 +321,12 @@ function getShortcutsByCategory(category) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="shortcuts-category">
|
<div class="shortcuts-category">
|
||||||
<h3>工具切换</h3>
|
<h3>{{ $t('Canvas.toolSwitching') }}</h3>
|
||||||
<table class="shortcuts-table">
|
<table class="shortcuts-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>操作</th>
|
<th>{{ $t('Canvas.Operation') }}</th>
|
||||||
<th>快捷键/手势</th>
|
<th>{{ $t('Canvas.ShortcutGesture') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -337,12 +339,12 @@ function getShortcutsByCategory(category) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="shortcuts-category">
|
<div class="shortcuts-category">
|
||||||
<h3>笔刷调整</h3>
|
<h3>{{ $t('Canvas.toolSwitching') }}</h3>
|
||||||
<table class="shortcuts-table">
|
<table class="shortcuts-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>操作</th>
|
<th>{{ $t('Canvas.Operation') }}</th>
|
||||||
<th>快捷键/手势</th>
|
<th>{{ $t('Canvas.ShortcutGesture') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import { ref, nextTick, computed, inject } from "vue";
|
|||||||
import { Checkbox } from "ant-design-vue";
|
import { Checkbox } from "ant-design-vue";
|
||||||
import { VueDraggable } from "vue-draggable-plus";
|
import { VueDraggable } from "vue-draggable-plus";
|
||||||
import { isGroupLayer } from "../../utils/layerHelper";
|
import { isGroupLayer } from "../../utils/layerHelper";
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
const {t} = useI18n()
|
||||||
// 设置组件名称,用于递归渲染
|
// 设置组件名称,用于递归渲染
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "LayerItem",
|
name: "LayerItem",
|
||||||
@@ -393,7 +394,7 @@ function findParentLayerId() {
|
|||||||
v-if="layer.thumbnailUrl"
|
v-if="layer.thumbnailUrl"
|
||||||
:src="layer.thumbnailUrl"
|
:src="layer.thumbnailUrl"
|
||||||
class="layer-thumbnail"
|
class="layer-thumbnail"
|
||||||
:alt="$t('图层预览')"
|
:alt="$t('Canvas.preview')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -423,7 +424,7 @@ function findParentLayerId() {
|
|||||||
<div
|
<div
|
||||||
class="visibility-btn"
|
class="visibility-btn"
|
||||||
@click.stop="handleToggleVisibility"
|
@click.stop="handleToggleVisibility"
|
||||||
:title="$t('显示/隐藏图层')"
|
:title="$t('Canvas.showHiddenLayer')"
|
||||||
>
|
>
|
||||||
<SvgIcon v-if="layer.visible" name="CEye" :size="16"></SvgIcon>
|
<SvgIcon v-if="layer.visible" name="CEye" :size="16"></SvgIcon>
|
||||||
<SvgIcon v-else name="CUnEye" :size="16"></SvgIcon>
|
<SvgIcon v-else name="CUnEye" :size="16"></SvgIcon>
|
||||||
@@ -447,7 +448,7 @@ function findParentLayerId() {
|
|||||||
<div
|
<div
|
||||||
class="delete-btn"
|
class="delete-btn"
|
||||||
:class="{ disabled: !canDelete }"
|
:class="{ disabled: !canDelete }"
|
||||||
:title="$t('删除图层')"
|
:title="$t('Canvas.deleteLayer')"
|
||||||
@click.stop="handleDelete"
|
@click.stop="handleDelete"
|
||||||
>
|
>
|
||||||
<SvgIcon name="CDelete" size="14"></SvgIcon>
|
<SvgIcon name="CDelete" size="14"></SvgIcon>
|
||||||
@@ -460,7 +461,7 @@ function findParentLayerId() {
|
|||||||
class="group-expand-icon"
|
class="group-expand-icon"
|
||||||
@click.stop="toggleGroupExpanded"
|
@click.stop="toggleGroupExpanded"
|
||||||
@dblclick.stop=""
|
@dblclick.stop=""
|
||||||
:title="isGroupExpanded ? $t('收起组') : $t('展开组')"
|
:title="isGroupExpanded ? $t('Canvas.CollapseUp') : $t('Canvas.CollapseDown')"
|
||||||
>
|
>
|
||||||
<SvgIcon
|
<SvgIcon
|
||||||
name="CRight"
|
name="CRight"
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import ContextMenu from "./ContextMenu.vue";
|
|||||||
import LayerItem from "./LayerItem.vue";
|
import LayerItem from "./LayerItem.vue";
|
||||||
import LayersList from "./LayersList.vue"; // 引入 LayersList 组件
|
import LayersList from "./LayersList.vue"; // 引入 LayersList 组件
|
||||||
import { createCrossLevelMoveCommand } from "../../commands/CrossLevelMoveCommands";
|
import { createCrossLevelMoveCommand } from "../../commands/CrossLevelMoveCommands";
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
const {t} = useI18n()
|
||||||
// // 导入命令类
|
// // 导入命令类
|
||||||
// import {
|
// import {
|
||||||
// ReorderLayersCommand,
|
// ReorderLayersCommand,
|
||||||
@@ -1523,7 +1525,7 @@ async function moveGroupToGroup(draggedLayer, fromParentId, toParentId, newIndex
|
|||||||
style="width: 0; height: 0; opacity: 0"
|
style="width: 0; height: 0; opacity: 0"
|
||||||
/> -->
|
/> -->
|
||||||
<h3>
|
<h3>
|
||||||
{{ $t("图层") }}
|
{{ $t("Canvas.layer") }}
|
||||||
{{ selectedLayerIds.length > 0 ? `(${selectedLayerIds.length})` : "" }}
|
{{ selectedLayerIds.length > 0 ? `(${selectedLayerIds.length})` : "" }}
|
||||||
</h3>
|
</h3>
|
||||||
<div class="layer-actions-group">
|
<div class="layer-actions-group">
|
||||||
@@ -1533,7 +1535,7 @@ async function moveGroupToGroup(draggedLayer, fromParentId, toParentId, newIndex
|
|||||||
class="group-btn action-btn"
|
class="group-btn action-btn"
|
||||||
:class="{ disabled: !canGroupLayers }"
|
:class="{ disabled: !canGroupLayers }"
|
||||||
@click="groupSelectedLayers"
|
@click="groupSelectedLayers"
|
||||||
:title="$t('创建组')"
|
:title="$t('Canvas.createGroup')"
|
||||||
>
|
>
|
||||||
<SvgIcon name="CCreateGroup" size="20"></SvgIcon>
|
<SvgIcon name="CCreateGroup" size="20"></SvgIcon>
|
||||||
</div>
|
</div>
|
||||||
@@ -1542,7 +1544,7 @@ async function moveGroupToGroup(draggedLayer, fromParentId, toParentId, newIndex
|
|||||||
class="ungroup-btn action-btn"
|
class="ungroup-btn action-btn"
|
||||||
:class="{ disabled: !canUngroupLayers }"
|
:class="{ disabled: !canUngroupLayers }"
|
||||||
@click="ungroupSelectedLayer"
|
@click="ungroupSelectedLayer"
|
||||||
:title="$t('解组')"
|
:title="$t('Canvas.slutionGroup')"
|
||||||
>
|
>
|
||||||
<SvgIcon name="CCancelGroup" size="20"></SvgIcon>
|
<SvgIcon name="CCancelGroup" size="20"></SvgIcon>
|
||||||
</div>
|
</div>
|
||||||
@@ -1550,7 +1552,7 @@ async function moveGroupToGroup(draggedLayer, fromParentId, toParentId, newIndex
|
|||||||
<div
|
<div
|
||||||
class="delete-selected-btn action-btn"
|
class="delete-selected-btn action-btn"
|
||||||
@click="deleteSelectedLayers"
|
@click="deleteSelectedLayers"
|
||||||
:title="$t('删除选中图层')"
|
:title="$t('Canvas.deleteLayer')"
|
||||||
>
|
>
|
||||||
<SvgIcon name="CDelete" size="16"></SvgIcon>
|
<SvgIcon name="CDelete" size="16"></SvgIcon>
|
||||||
</div>
|
</div>
|
||||||
@@ -1558,7 +1560,7 @@ async function moveGroupToGroup(draggedLayer, fromParentId, toParentId, newIndex
|
|||||||
<div
|
<div
|
||||||
class="clear-selection-btn action-btn"
|
class="clear-selection-btn action-btn"
|
||||||
@click="clearSelection"
|
@click="clearSelection"
|
||||||
:title="$t('清除选择')"
|
:title="$t('Canvas.clearSelection')"
|
||||||
>
|
>
|
||||||
<SvgIcon name="CCloseNo" size="14"></SvgIcon>
|
<SvgIcon name="CCloseNo" size="14"></SvgIcon>
|
||||||
</div>
|
</div>
|
||||||
@@ -1570,7 +1572,7 @@ async function moveGroupToGroup(draggedLayer, fromParentId, toParentId, newIndex
|
|||||||
v-if="isChildLayerActive"
|
v-if="isChildLayerActive"
|
||||||
class="add-layer-btn action-btn"
|
class="add-layer-btn action-btn"
|
||||||
@click="addTopLayer"
|
@click="addTopLayer"
|
||||||
:title="$t('添加顶级图层')"
|
:title="$t('Canvas.AddPinnedLayer')"
|
||||||
>
|
>
|
||||||
<SvgIcon name="CPlusTop" size="16"></SvgIcon>
|
<SvgIcon name="CPlusTop" size="16"></SvgIcon>
|
||||||
</div>
|
</div>
|
||||||
@@ -1587,8 +1589,8 @@ async function moveGroupToGroup(draggedLayer, fromParentId, toParentId, newIndex
|
|||||||
|
|
||||||
<!-- 多选提示条 -->
|
<!-- 多选提示条 -->
|
||||||
<div v-if="isMultiSelectMode" class="multi-select-info">
|
<div v-if="isMultiSelectMode" class="multi-select-info">
|
||||||
<span>已选择 {{ selectedLayerIds.length }} 个图层</span>
|
<span>{{ $t('Canvas.Hint') }}{{ selectedLayerIds.length }}</span>
|
||||||
<small>提示:按住 Ctrl/Cmd 多选,Shift 范围选择,长按进入多选模式</small>
|
<small>{{ $t('Canvas.Hint') }}</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 图层列表组件 -->
|
<!-- 图层列表组件 -->
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ 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 { uploadImageAndCreateLayer, loadImageUrlToLayer, loadImage } from "./utils/imageHelper.js";
|
||||||
// import MinimapPanel from "./components/MinimapPanel.vue";
|
// import MinimapPanel from "./components/MinimapPanel.vue";
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
const {t} = useI18n()
|
||||||
const KeyboardShortcutHelp = defineAsyncComponent(
|
const KeyboardShortcutHelp = defineAsyncComponent(
|
||||||
() => import("./components/KeyboardShortcutHelp.vue")
|
() => import("./components/KeyboardShortcutHelp.vue")
|
||||||
);
|
);
|
||||||
@@ -514,7 +516,7 @@ function updateCanvasColor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function addLayer() {
|
async function addLayer() {
|
||||||
await layerManager.createLayer("空图层");
|
await layerManager.createLayer(t('Canvas.EmptyLayer'));
|
||||||
}
|
}
|
||||||
async function addTopLayer() {
|
async function addTopLayer() {
|
||||||
await layerManager.createLayer("空图层", LayerType.EMPTY, {
|
await layerManager.createLayer("空图层", LayerType.EMPTY, {
|
||||||
@@ -980,9 +982,9 @@ defineExpose({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="zoom-info">
|
<div class="zoom-info">
|
||||||
缩放: {{ currentZoom }}%
|
{{ t('Canvas.Scale') }}: {{ currentZoom }}%
|
||||||
<button class="reset-zoom" @click="resetZoom">重置视图</button>
|
<button class="reset-zoom" @click="resetZoom">{{ $t('Canvas.ResetLayer') }}</button>
|
||||||
<button class="help-btn" @click="toggleShortcutHelp" title="查看快捷键和触控操作">
|
<button class="help-btn" @click="toggleShortcutHelp" :title="$t('Canvas.Help')">
|
||||||
?
|
?
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ import { fabric } from "fabric-with-all";
|
|||||||
import { getOriginObjectInfo } from "../utils/layerUtils";
|
import { getOriginObjectInfo } from "../utils/layerUtils";
|
||||||
import { restoreFabricObject } from "../utils/objectHelper";
|
import { restoreFabricObject } from "../utils/objectHelper";
|
||||||
import { UpdateGroupMaskPositionCommand } from "../commands/UpdateGroupMaskPositionCommand";
|
import { UpdateGroupMaskPositionCommand } from "../commands/UpdateGroupMaskPositionCommand";
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
const {t} = useI18n()
|
||||||
/**
|
/**
|
||||||
* 图层管理器 - 负责管理画布上的所有图层
|
* 图层管理器 - 负责管理画布上的所有图层
|
||||||
* 包含图层的创建、删除、修改、排序等操作
|
* 包含图层的创建、删除、修改、排序等操作
|
||||||
@@ -579,7 +580,7 @@ export class LayerManager {
|
|||||||
this.createFixedLayer();
|
this.createFixedLayer();
|
||||||
|
|
||||||
// 创建一个空白图层(默认位于背景图层和固定图层之上)
|
// 创建一个空白图层(默认位于背景图层和固定图层之上)
|
||||||
await this.createLayer("图层 1");
|
await this.createLayer(t('Canvas.Layer1'));
|
||||||
} else {
|
} else {
|
||||||
// 检查是否已有背景层
|
// 检查是否已有背景层
|
||||||
const hasBackgroundLayer = this.layers.value.some((layer) => layer.isBackground);
|
const hasBackgroundLayer = this.layers.value.some((layer) => layer.isBackground);
|
||||||
@@ -601,7 +602,7 @@ export class LayerManager {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!hasNormalLayer) {
|
if (!hasNormalLayer) {
|
||||||
await this.createLayer("图层 1");
|
await this.createLayer(t('Canvas.Layer1'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -546,7 +546,7 @@ setup(props:any,{emit}) {
|
|||||||
productimg.selectGenerate.listType = listType
|
productimg.selectGenerate.listType = listType
|
||||||
productimg.selectGenerate.isIndex = index
|
productimg.selectGenerate.isIndex = index
|
||||||
|
|
||||||
if(!list[index]?.id &&( (list[index].resultType == 'PoseTransfer' && !list[index].gifUrl) || (list[index].resultType == 'PoseTransfer' && !list[index].url))){
|
if(( (list[index].resultType == 'PoseTransfer' && !list[index].gifUrl) || (list[index].resultType !== 'PoseTransfer' && !list[index].url))){
|
||||||
productimg.productimgIsProductimg = true
|
productimg.productimgIsProductimg = true
|
||||||
productimg.productimgRemProductimg = true
|
productimg.productimgRemProductimg = true
|
||||||
setPrductimg([list[index].taskId])
|
setPrductimg([list[index].taskId])
|
||||||
@@ -626,6 +626,8 @@ setup(props:any,{emit}) {
|
|||||||
// productimg.likeDesignCollectionList[index].childList[childIndex] = productimg.generateCourse
|
// productimg.likeDesignCollectionList[index].childList[childIndex] = productimg.generateCourse
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
let emitData = {
|
let emitData = {
|
||||||
status:productimg.openType,
|
status:productimg.openType,
|
||||||
generateCourse:[{
|
generateCourse:[{
|
||||||
@@ -633,7 +635,6 @@ setup(props:any,{emit}) {
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
emit('upDataDesignLikeList',emitData)
|
emit('upDataDesignLikeList',emitData)
|
||||||
}
|
|
||||||
productimg.openType = ''
|
productimg.openType = ''
|
||||||
|
|
||||||
scaleImage.value = false
|
scaleImage.value = false
|
||||||
|
|||||||
@@ -1069,6 +1069,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
const generateLoad = async (data:any)=>{
|
const generateLoad = async (data:any)=>{
|
||||||
// return
|
// return
|
||||||
|
console.log(data)
|
||||||
clearInterval(prductimgTime.ToProductImage)
|
clearInterval(prductimgTime.ToProductImage)
|
||||||
clearInterval(prductimgTime.PoseTransfer)
|
clearInterval(prductimgTime.PoseTransfer)
|
||||||
clearInterval(prductimgTime.Relight)
|
clearInterval(prductimgTime.Relight)
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ export default defineComponent({
|
|||||||
dataDom.editCanvas.addImageToLayer(url,{layerId:dataDom.editCanvas.layers[0].id,imageMode:'contains',undoable:false})
|
dataDom.editCanvas.addImageToLayer(url,{layerId:dataDom.editCanvas.layers[0].id,imageMode:'contains',undoable:false})
|
||||||
}
|
}
|
||||||
const canvasInit = (value)=>{
|
const canvasInit = (value)=>{
|
||||||
|
if(!props.imgUrl)return
|
||||||
canvasLoadAddImg(props.imgUrl,value.layers.value[0].id)
|
canvasLoadAddImg(props.imgUrl,value.layers.value[0].id)
|
||||||
}
|
}
|
||||||
const getCanvasData = ()=>{
|
const getCanvasData = ()=>{
|
||||||
@@ -89,10 +90,40 @@ export default defineComponent({
|
|||||||
|
|
||||||
}
|
}
|
||||||
const exportElement = ()=>{
|
const exportElement = ()=>{
|
||||||
canvasEditor.value.exportImage({isContainBg:true,isContainFixed:false,isCropByBg:true}).then((rv)=>{
|
dataDom.editCanvas.exportImage({isContainBg:true,isContainFixed:false,isCropByBg:true}).then((rv)=>{
|
||||||
downloadBase64Image(rv,'canvas')
|
downloadBase64Image(rv,'canvas')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
function downloadBase64Image(base64Data, filename) {
|
||||||
|
// 1. 提取MIME类型(自动处理各种Base64前缀)
|
||||||
|
const mimeMatch = base64Data.match(/^data:(.+?);base64,/);
|
||||||
|
if (!mimeMatch) {
|
||||||
|
console.error('Invalid Base64 data');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 2. 获取扩展名
|
||||||
|
const mimeType = mimeMatch[1];
|
||||||
|
const extension = mimeType.split('/')[1] || 'png';
|
||||||
|
|
||||||
|
// 3. 转换Base64为Blob
|
||||||
|
const byteString = atob(base64Data.split(',')[1]);
|
||||||
|
const ab = new ArrayBuffer(byteString.length);
|
||||||
|
const ia = new Uint8Array(ab);
|
||||||
|
for (let i = 0; i < byteString.length; i++) {
|
||||||
|
ia[i] = byteString.charCodeAt(i);
|
||||||
|
}
|
||||||
|
const blob = new Blob([ab], { type: mimeType });
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = url;
|
||||||
|
a.download = `${filename}.${extension}`;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
setTimeout(() => {
|
||||||
|
document.body.removeChild(a);
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
const changeCanvas = ()=>{
|
const changeCanvas = ()=>{
|
||||||
emit('canvasChangeGetJSON',{canvasJSON:dataDom.editCanvas.getJSON(),submitDate:5000})
|
emit('canvasChangeGetJSON',{canvasJSON:dataDom.editCanvas.getJSON(),submitDate:5000})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -977,4 +977,53 @@ export default {
|
|||||||
System:'系统',
|
System:'系统',
|
||||||
Library:'库',
|
Library:'库',
|
||||||
},
|
},
|
||||||
|
Canvas:{
|
||||||
|
layer:'图层',
|
||||||
|
createGroup:'创建组',
|
||||||
|
slutionGroup:'解组',
|
||||||
|
deleteLayer:'删除图层',
|
||||||
|
clearSelection:'清除选择',
|
||||||
|
AddPinnedLayer:'添加置顶图层',
|
||||||
|
selectedLayers:'选中的图层数量:',
|
||||||
|
Hint:'提示:按住 Ctrl/Cmd 多选,Shift 范围选择,长按进入多选模式',
|
||||||
|
CollapseUp:'收起组',
|
||||||
|
CollapseDown:'展开组',
|
||||||
|
showGroup:'显示图层',
|
||||||
|
hideGroup:'隐藏图层',
|
||||||
|
showHiddenLayer:'显示/隐藏图层',
|
||||||
|
preview:'预览',
|
||||||
|
EmptyLayer:'空图层',
|
||||||
|
Scale:'缩放',
|
||||||
|
ResetLayer:'重置视图',
|
||||||
|
Help:'查看快捷键和触控操作',
|
||||||
|
width:'宽度',
|
||||||
|
height:'高度',
|
||||||
|
color:'颜色',
|
||||||
|
KeyboardShortcutsOperationGuide:'键盘快捷键 & 操作指南',
|
||||||
|
TheDetectedPlatform:'检测到的平台',
|
||||||
|
BasicOperations:'基础操作',
|
||||||
|
Operation:'操作',
|
||||||
|
ShortcutGesture:'快捷键/手势',
|
||||||
|
viewOperations:'视图操作',
|
||||||
|
toolSwitching:'工具切换',
|
||||||
|
BrushAdjustmentOperation:'笔刷调整',
|
||||||
|
undo:'撤销',
|
||||||
|
Redo:'重做',
|
||||||
|
Copy:'复制',
|
||||||
|
Paste:'粘贴',
|
||||||
|
Cut:'剪切',
|
||||||
|
DeleteSelectedElement:'删除选中元素',
|
||||||
|
MoveCanvas:'移动画布',
|
||||||
|
ZoomCanvas:'缩放画布',
|
||||||
|
MouseWheel:'鼠标滚轮',
|
||||||
|
MacZoomCanvas:'鼠标滚轮 或 触控板缩放手势',
|
||||||
|
SelectionMode:'选择模式',
|
||||||
|
PaintingMode:'绘画模式',
|
||||||
|
EraserMode:'橡皮擦模式',
|
||||||
|
LassoTool:'套索工具',
|
||||||
|
LiquifyTool:'液化工具',
|
||||||
|
DecreaseBrush:'增加笔触大小',
|
||||||
|
IncreaseBrush:'减小笔触大小',
|
||||||
|
Layer1:'图层 1',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -977,4 +977,53 @@ export default {
|
|||||||
System:'System',
|
System:'System',
|
||||||
Library:'Library',
|
Library:'Library',
|
||||||
},
|
},
|
||||||
|
Canvas:{
|
||||||
|
layer:'Layer',
|
||||||
|
createGroup:'Create Group',
|
||||||
|
slutionGroup:'Slution Group',
|
||||||
|
deleteLayer:'Delete Layer',
|
||||||
|
clearSelection:'Clear Selection',
|
||||||
|
AddPinnedLayer:'Add a pinned layer',
|
||||||
|
selectedLayers:'The number of selected layers:',
|
||||||
|
Hint:'Hint: Hold down Ctrl/Cmd for multiple selections, Shift for range selection, and long press to enter the multiple selection mode',
|
||||||
|
CollapseUp:'Collapse Up',
|
||||||
|
CollapseDown:'Collapse Down',
|
||||||
|
showGroup:'Show Layer',
|
||||||
|
hideGroup:'Hidden Layer',
|
||||||
|
showHiddenLayer:'Show/Hidden Layer',
|
||||||
|
preview:'Preview',
|
||||||
|
EmptyLayer:'Empty layer',
|
||||||
|
Scale:'Scale',
|
||||||
|
ResetLayer:'Reset Layer',
|
||||||
|
Help:'View the shortcut keys and touch operations',
|
||||||
|
width:'Width',
|
||||||
|
height:'Height',
|
||||||
|
color:'Color',
|
||||||
|
KeyboardShortcutsOperationGuide:'Keyboard shortcuts & Operation guide',
|
||||||
|
TheDetectedPlatform:'Guide Detected Platform',
|
||||||
|
BasicOperations:'Basic Operations',
|
||||||
|
Operation:'Operation',
|
||||||
|
ShortcutGesture:'Shortcut/Gesture',
|
||||||
|
viewOperations:'View Operations',
|
||||||
|
toolSwitching:'Tool Switching',
|
||||||
|
BrushAdjustmentOperation:'Brush Adjustment Operation',
|
||||||
|
Undo:'Undo',
|
||||||
|
Redo:'Redo',
|
||||||
|
Copy:'Copy',
|
||||||
|
Paste:'Paste',
|
||||||
|
Cut:'Cut',
|
||||||
|
DeleteSelectedElement:'Delete Selected Element',
|
||||||
|
MoveCanvas:'Move Canvas',
|
||||||
|
ZoomCanvas:'Zoom Canvas',
|
||||||
|
MouseWheel:'Mouse Wheel',
|
||||||
|
MacZoomCanvas:'Mouse scroll wheel or touchpad zoom gesture',
|
||||||
|
SelectionMode:'Selection Mode',
|
||||||
|
PaintingMode:'Painting Mode',
|
||||||
|
EraserMode:'Eraser Mode',
|
||||||
|
LassoTool:'Lasso Tool',
|
||||||
|
LiquifyTool:'Liquify Tool',
|
||||||
|
DecreaseBrush:'Decrease Brush',
|
||||||
|
IncreaseBrush:'Increase Brush',
|
||||||
|
Layer1:'Layer 1',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1115,10 +1115,14 @@ export default defineComponent({
|
|||||||
border-radius: .8rem;
|
border-radius: .8rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
// flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
flex-wrap: nowrap;
|
// flex-wrap: nowrap;
|
||||||
|
|
||||||
|
|
||||||
|
&.history{
|
||||||
|
> .text{
|
||||||
|
flex-basis: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
> .time{
|
> .time{
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
opacity: .5;
|
opacity: .5;
|
||||||
|
|||||||
Reference in New Issue
Block a user