From 5f3c4b5ac9a0bce96c7a94106e89c87879b9f334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BF=97=E9=B9=8F?= <2916022834@qq.com> Date: Tue, 11 Nov 2025 10:13:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=BB=E5=B8=83=E5=8F=8C=E5=87=BB=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=86=85=E9=83=A8=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CanvasEditor/commands/LayerCommands.js | 2 +- .../components/SelectMenuPanel.vue | 42 ++++++++++++------- .../Canvas/ExistsImageList/index.vue | 11 +++-- src/component/common/SelectImages.vue | 15 +++++-- 4 files changed, 49 insertions(+), 21 deletions(-) diff --git a/src/component/Canvas/CanvasEditor/commands/LayerCommands.js b/src/component/Canvas/CanvasEditor/commands/LayerCommands.js index 66880184..0380638e 100644 --- a/src/component/Canvas/CanvasEditor/commands/LayerCommands.js +++ b/src/component/Canvas/CanvasEditor/commands/LayerCommands.js @@ -2595,7 +2595,7 @@ export class CreateImageLayerCommand extends Command { // 生成图层名称 const fileName = - this.layerName || `图片 ${new Date().toLocaleTimeString()}`; + this.layerName || `${new Date().toLocaleString()}`; this.fabricImage.set({ id: this.imageId, diff --git a/src/component/Canvas/CanvasEditor/components/SelectMenuPanel.vue b/src/component/Canvas/CanvasEditor/components/SelectMenuPanel.vue index 917d0816..d02015c8 100644 --- a/src/component/Canvas/CanvasEditor/components/SelectMenuPanel.vue +++ b/src/component/Canvas/CanvasEditor/components/SelectMenuPanel.vue @@ -58,11 +58,15 @@
-

{{ t('Canvas.flipHorizontal') }}

+

+ {{ t("Canvas.flipHorizontal") }} +

-

{{ t('Canvas.flipVertical') }}

+

+ {{ t("Canvas.flipVertical") }} +

@@ -225,16 +229,22 @@ const initialState = TransformCommand.captureTransformState(obj); const finalState = { ...initialState }; const angle = e.target.value; - const { x, y } = calculateRotatedTopLeftDeg( - obj.width * obj.scaleX, - obj.height * obj.scaleY, - obj.left, - obj.top, - obj.angle, - angle - ); - finalState.left = x; - finalState.top = y; + if (obj.originX === "left" && obj.originY === "top") { + const width = obj.width * obj.scaleX; + const height = obj.height * obj.scaleY; + const left = obj.left; + const top = obj.top; + const { x, y } = calculateRotatedTopLeftDeg( + width, + height, + left, + top, + obj.angle, + angle + ); + finalState.left = x; + finalState.top = y; + } finalState.angle = angle; transformObject(obj, initialState, finalState); }; @@ -257,7 +267,12 @@ arrs.forEach((v) => { activeObjects.value.forEach((item) => { if (item.id === v.id) { - keys.forEach((key) => (item[key] = v[key])); + keys.forEach((k) => { + item[k] = + typeof v[k] === "number" + ? Number(v[k].toFixed(3)) + : v[k]; + }); } }); activeObjects.value = [...activeObjects.value]; @@ -271,7 +286,6 @@ } else { arrs.push(e.target); } - console.log(e.target); updateActiveObjects(arrs, ["angle"]); }; diff --git a/src/component/Canvas/ExistsImageList/index.vue b/src/component/Canvas/ExistsImageList/index.vue index d1aaab6c..2f18de34 100644 --- a/src/component/Canvas/ExistsImageList/index.vue +++ b/src/component/Canvas/ExistsImageList/index.vue @@ -44,16 +44,17 @@ :key="index" class="image-item" @click="handleImageClick(item)" + @dblclick="handleImageDoubleClick(item)" >
- {{ item.name || "未命名" }} + {{ item.name }}
-

加载中...

@@ -279,6 +279,14 @@ const handleImageClick = item => { } } +// 处理图片双击 +const handleImageDoubleClick = item => { + selectList.value = [item.url] + confirm() +} + + + // 处理分类切换 const handleChangeCategory = category => { // console.log('handleChangeCategory',category) @@ -307,6 +315,7 @@ const confirm = () => { emitData = selectList.value } emits('select', emitData) + selectList.value = [] showPanel.value = false }