mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
perf: 右键取消元素创建
This commit is contained in:
parent
8a8a597208
commit
3771b6933d
@ -3,6 +3,7 @@
|
|||||||
class="element-create-selection"
|
class="element-create-selection"
|
||||||
ref="selectionRef"
|
ref="selectionRef"
|
||||||
@mousedown.stop="$event => createSelection($event)"
|
@mousedown.stop="$event => createSelection($event)"
|
||||||
|
@contextmenu.stop.prevent
|
||||||
>
|
>
|
||||||
<div :class="['selection', creatingElement.type]" v-if="start && end" :style="position">
|
<div :class="['selection', creatingElement.type]" v-if="start && end" :style="position">
|
||||||
|
|
||||||
@ -29,7 +30,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, onMounted, reactive, ref } from 'vue'
|
import { computed, defineComponent, onMounted, reactive, ref } from 'vue'
|
||||||
import { useStore } from '@/store'
|
import { MutationTypes, useStore } from '@/store'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'element-create-selection',
|
name: 'element-create-selection',
|
||||||
@ -104,6 +105,12 @@ export default defineComponent({
|
|||||||
document.onmouseup = e => {
|
document.onmouseup = e => {
|
||||||
document.onmousemove = null
|
document.onmousemove = null
|
||||||
document.onmouseup = null
|
document.onmouseup = null
|
||||||
|
|
||||||
|
if (e.button === 2) {
|
||||||
|
setTimeout(() => store.commit(MutationTypes.SET_CREATING_ELEMENT, null), 0)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
isMouseDown = false
|
isMouseDown = false
|
||||||
|
|
||||||
const endPageX = e.pageX
|
const endPageX = e.pageX
|
||||||
|
Loading…
x
Reference in New Issue
Block a user