mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
update
This commit is contained in:
parent
ccf935615e
commit
ded04bf837
@ -1,23 +1,16 @@
|
||||
<template>
|
||||
<div
|
||||
class="alignment-line"
|
||||
:style="{
|
||||
left: axis.x + 'px',
|
||||
top: axis.y + 'px',
|
||||
}"
|
||||
>
|
||||
<div
|
||||
:class="['line', type]"
|
||||
:style="type === 'vertical' ? { height: length + 'px' } : { width: length + 'px' }"
|
||||
></div>
|
||||
<div class="alignment-line" :style="{ left, top }">
|
||||
<div :class="['line', type]" :style="sizeStyle"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { computed, PropType, defineComponent } from 'vue'
|
||||
import { useStore } from 'vuex'
|
||||
import { State } from '@/store'
|
||||
import { AlignmentLineAxis } from '@/types/edit'
|
||||
|
||||
export default {
|
||||
export default defineComponent({
|
||||
name: 'alignment-line',
|
||||
props: {
|
||||
type: {
|
||||
@ -32,8 +25,34 @@ export default {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
offsetX: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
offsetY: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
setup(props) {
|
||||
const store = useStore<State>()
|
||||
const canvasScale = computed(() => store.state.canvasScale)
|
||||
|
||||
const left = computed(() => props.axis.x * canvasScale.value + props.offsetX + 'px')
|
||||
const top = computed(() => props.axis.y * canvasScale.value + props.offsetY + 'px')
|
||||
|
||||
const sizeStyle = computed(() => {
|
||||
if(props.type === 'vertical') return { height: props.length * canvasScale.value + 'px' }
|
||||
return { width: props.length * canvasScale.value + 'px' }
|
||||
})
|
||||
|
||||
return {
|
||||
left,
|
||||
top,
|
||||
sizeStyle,
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -7,6 +7,15 @@
|
||||
v-contextmenu="contextmenus"
|
||||
v-click-outside="removeEditorAreaFocus"
|
||||
>
|
||||
<AlignmentLine
|
||||
v-for="(line, index) in alignmentLines"
|
||||
:key="index"
|
||||
:type="line.type"
|
||||
:axis="line.axis"
|
||||
:length="line.length"
|
||||
:offsetX="viewportStyles.left"
|
||||
:offsetY="viewportStyles.top"
|
||||
/>
|
||||
<div
|
||||
class="viewport"
|
||||
ref="viewportRef"
|
||||
@ -27,11 +36,6 @@
|
||||
:quadrant="mouseSelectionState.quadrant"
|
||||
/>
|
||||
|
||||
<AlignmentLine
|
||||
v-for="(line, index) in alignmentLines" :key="index"
|
||||
:type="line.type" :axis="line.axis" :length="line.length"
|
||||
/>
|
||||
|
||||
<MultiSelectOperate
|
||||
v-if="activeElementIdList.length > 1"
|
||||
:elementList="elementList"
|
||||
|
Loading…
x
Reference in New Issue
Block a user