mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
Merge branch '772778995-master'
This commit is contained in:
commit
9b8a742a37
@ -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<PPTElement[]>) => {
|
||||
const slidesStore = useSlidesStore()
|
||||
const { canvasScale } = storeToRefs(useMainStore())
|
||||
|
||||
const { ctrlOrShiftKeyActive } = storeToRefs(useKeyboardStore())
|
||||
const { addHistorySnapshot } = useHistorySnapshot()
|
||||
|
||||
// 拖拽线条端点
|
||||
@ -182,9 +182,16 @@ export default (elementList: Ref<PPTElement[]>) => {
|
||||
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 (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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user