From a1bc2bfc2fee262a013a7c577bf988a98bfaa49b Mon Sep 17 00:00:00 2001 From: whc <772778995@qq.com> Date: Thu, 30 Nov 2023 09:08:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=85=83=E7=B4=A0?= =?UTF-8?q?=E6=8A=98=E7=BA=BF=E7=BA=BF=E6=9D=A1=EF=BC=8C=E5=9C=A8=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E4=B8=A4=E7=AB=AF=E9=94=9A=E7=82=B9=E4=BC=9A=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E4=B8=AD=E9=97=B4=E9=94=9A=E7=82=B9=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Editor/Canvas/hooks/useDragLineElement.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/Editor/Canvas/hooks/useDragLineElement.ts b/src/views/Editor/Canvas/hooks/useDragLineElement.ts index 3ff50269..114d9d83 100644 --- a/src/views/Editor/Canvas/hooks/useDragLineElement.ts +++ b/src/views/Editor/Canvas/hooks/useDragLineElement.ts @@ -182,9 +182,9 @@ export default (elementList: Ref) => { end: end, } if (command === OperateLineHandlers.START || command === OperateLineHandlers.END) { - if (element.broken) newEl.broken = [(start[0] + end[0]) / 2, (start[1] + end[1]) / 2] - if (element.curve) newEl.curve = [(start[0] + end[0]) / 2, (start[1] + end[1]) / 2] - if (element.cubic) newEl.cubic = [[(start[0] + end[0]) / 2, (start[1] + end[1]) / 2], [(start[0] + end[0]) / 2, (start[1] + end[1]) / 2]] + if (element.broken) newEl.broken = [midX - minX, midY - minY] + if (element.curve) newEl.curve = [midX - minX, midY - minY] + if (element.cubic) newEl.cubic = [[c1X - minX, c1Y - minY], [c2X - minX, c2Y - minY]] } else if (command === OperateLineHandlers.C) { if (element.broken) newEl.broken = [midX - minX, midY - minY] From e26190121275fe7ae6c951dd40f146de407b19eb Mon Sep 17 00:00:00 2001 From: pipipi-pikachu Date: Tue, 5 Dec 2023 21:48:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E6=8A=98?= =?UTF-8?q?=E7=BA=BF/=E6=9B=B2=E7=BA=BF=E7=AB=AF=E7=82=B9=E6=97=B6?= =?UTF-8?q?=EF=BC=8Cctrl=E9=94=AE=E5=8F=AF=E9=80=89=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E5=85=B3=E9=94=AE=E7=82=B9=EF=BC=88#236?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Editor/Canvas/hooks/useDragLineElement.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/views/Editor/Canvas/hooks/useDragLineElement.ts b/src/views/Editor/Canvas/hooks/useDragLineElement.ts index 114d9d83..7c20a4ff 100644 --- a/src/views/Editor/Canvas/hooks/useDragLineElement.ts +++ b/src/views/Editor/Canvas/hooks/useDragLineElement.ts @@ -1,6 +1,6 @@ import type { Ref } from 'vue' import { storeToRefs } from 'pinia' -import { useMainStore, useSlidesStore } from '@/store' +import { useKeyboardStore, useMainStore, useSlidesStore } from '@/store' import type { PPTElement, PPTLineElement } from '@/types/slides' import { OperateLineHandlers } from '@/types/edit' import useHistorySnapshot from '@/hooks/useHistorySnapshot' @@ -13,7 +13,7 @@ interface AdsorptionPoint { export default (elementList: Ref) => { const slidesStore = useSlidesStore() const { canvasScale } = storeToRefs(useMainStore()) - + const { ctrlOrShiftKeyActive } = storeToRefs(useKeyboardStore()) const { addHistorySnapshot } = useHistorySnapshot() // 拖拽线条端点 @@ -182,9 +182,16 @@ export default (elementList: Ref) => { end: end, } if (command === OperateLineHandlers.START || command === OperateLineHandlers.END) { - if (element.broken) newEl.broken = [midX - minX, midY - minY] - if (element.curve) newEl.curve = [midX - minX, midY - minY] - if (element.cubic) newEl.cubic = [[c1X - minX, c1Y - minY], [c2X - minX, c2Y - minY]] + if (ctrlOrShiftKeyActive.value) { + if (element.broken) newEl.broken = [midX - minX, midY - minY] + if (element.curve) newEl.curve = [midX - minX, midY - minY] + if (element.cubic) newEl.cubic = [[c1X - minX, c1Y - minY], [c2X - minX, c2Y - minY]] + } + else { + if (element.broken) newEl.broken = [(start[0] + end[0]) / 2, (start[1] + end[1]) / 2] + if (element.curve) newEl.curve = [(start[0] + end[0]) / 2, (start[1] + end[1]) / 2] + if (element.cubic) newEl.cubic = [[(start[0] + end[0]) / 2, (start[1] + end[1]) / 2], [(start[0] + end[0]) / 2, (start[1] + end[1]) / 2]] + } } else if (command === OperateLineHandlers.C) { if (element.broken) newEl.broken = [midX - minX, midY - minY]