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 }