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>
|
<template>
|
||||||
<div
|
<div class="alignment-line" :style="{ left, top }">
|
||||||
class="alignment-line"
|
<div :class="['line', type]" :style="sizeStyle"></div>
|
||||||
:style="{
|
|
||||||
left: axis.x + 'px',
|
|
||||||
top: axis.y + 'px',
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
:class="['line', type]"
|
|
||||||
:style="type === 'vertical' ? { height: length + 'px' } : { width: length + 'px' }"
|
|
||||||
></div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<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'
|
import { AlignmentLineAxis } from '@/types/edit'
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
name: 'alignment-line',
|
name: 'alignment-line',
|
||||||
props: {
|
props: {
|
||||||
type: {
|
type: {
|
||||||
@ -32,8 +25,34 @@ export default {
|
|||||||
type: Number,
|
type: Number,
|
||||||
required: true,
|
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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -7,6 +7,15 @@
|
|||||||
v-contextmenu="contextmenus"
|
v-contextmenu="contextmenus"
|
||||||
v-click-outside="removeEditorAreaFocus"
|
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
|
<div
|
||||||
class="viewport"
|
class="viewport"
|
||||||
ref="viewportRef"
|
ref="viewportRef"
|
||||||
@ -27,11 +36,6 @@
|
|||||||
:quadrant="mouseSelectionState.quadrant"
|
:quadrant="mouseSelectionState.quadrant"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<AlignmentLine
|
|
||||||
v-for="(line, index) in alignmentLines" :key="index"
|
|
||||||
:type="line.type" :axis="line.axis" :length="line.length"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<MultiSelectOperate
|
<MultiSelectOperate
|
||||||
v-if="activeElementIdList.length > 1"
|
v-if="activeElementIdList.length > 1"
|
||||||
:elementList="elementList"
|
:elementList="elementList"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user