Commit 6d658571 authored by zhengke's avatar zhengke

字体样式 回车事件

parent 7ed6e01f
...@@ -101,6 +101,7 @@ import ConfigService from '@/services/ConfigService' ...@@ -101,6 +101,7 @@ import ConfigService from '@/services/ConfigService'
import { VIEWPORT_SIZE, VIEWPORT_VER_SIZE } from '@/configs/canvas' import { VIEWPORT_SIZE, VIEWPORT_VER_SIZE } from '@/configs/canvas'
import FileService from '@/services/FileService' import FileService from '@/services/FileService'
import SpiderResource from '@/views/Editor/CanvasTool/SpiderResource.vue' import SpiderResource from '@/views/Editor/CanvasTool/SpiderResource.vue'
import type { PPTImageElement, SlideBackground } from '@/types/slides'
import FileInput from '@/components/FileInput.vue' import FileInput from '@/components/FileInput.vue'
const showVisible = ref(true) const showVisible = ref(true)
...@@ -150,6 +151,7 @@ const { addHistorySnapshot } = useHistorySnapshot() ...@@ -150,6 +151,7 @@ const { addHistorySnapshot } = useHistorySnapshot()
const slidesStore = useSlidesStore() const slidesStore = useSlidesStore()
const { slides, currentSlide, slideIndex, layoutSlides } = storeToRefs(slidesStore) const { slides, currentSlide, slideIndex, layoutSlides } = storeToRefs(slidesStore)
const { handleElement, handleElementId } = storeToRefs(mainStore) const { handleElement, handleElementId } = storeToRefs(mainStore)
const handleImageElement = handleElement as Ref<PPTImageElement>
const handleSizeChange = (val: number) => { const handleSizeChange = (val: number) => {
console.log(`${val} items per page`) console.log(`${val} items per page`)
...@@ -218,8 +220,8 @@ const setImgs = async () => { ...@@ -218,8 +220,8 @@ const setImgs = async () => {
close() close()
} }
if(imgType.value==2){ if(imgType.value==2){
let width = propsDatas.value.width let width = handleImageElement.value.width
let height = propsDatas.value.height let height = handleImageElement.value.height
let maxWidth = VIEWPORT_SIZE,maxHeight = VIEWPORT_VER_SIZE.Value, viewportRatio = slidesStore.viewportRatio let maxWidth = VIEWPORT_SIZE,maxHeight = VIEWPORT_VER_SIZE.Value, viewportRatio = slidesStore.viewportRatio
if(viewportRatio<1){ if(viewportRatio<1){
maxWidth = VIEWPORT_VER_SIZE.Value maxWidth = VIEWPORT_VER_SIZE.Value
...@@ -245,7 +247,7 @@ const setImgs = async () => { ...@@ -245,7 +247,7 @@ const setImgs = async () => {
tempSize.height = Math.ceil(tempSize.height*ratio) tempSize.height = Math.ceil(tempSize.height*ratio)
} }
if(tempSize.height<height){ if(tempSize.height<height){
let ratio = height / tempSize.height let ratio = height/tempSize.height
tempSize.width = Math.ceil(tempSize.width*ratio) tempSize.width = Math.ceil(tempSize.width*ratio)
tempSize.height = Math.ceil(tempSize.height*ratio) tempSize.height = Math.ceil(tempSize.height*ratio)
} }
......
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
class="inline-input w-50" class="inline-input w-50"
placeholder="例:14px" placeholder="例:14px"
@select="handleSelect('fontsize')" @select="handleSelect('fontsize')"
@blur="handleSelect('fontsize')"> @blur="handleSelect('fontsize')"
@keyup.enter="handleSelect('fontsize')">
<template #suffix> <template #suffix>
<IconAddText /> <IconAddText />
</template> </template>
...@@ -298,7 +299,8 @@ ...@@ -298,7 +299,8 @@
class="inline-input w-50" class="inline-input w-50"
placeholder="字体行间距" placeholder="字体行间距"
@select="handleSelect('lineHeight')" @select="handleSelect('lineHeight')"
@blur="handleSelect('lineHeight')"> @blur="handleSelect('lineHeight')"
@keyup.enter="handleSelect('lineHeight')">
<template #suffix> <template #suffix>
<IconRowHeight /> <IconRowHeight />
</template> </template>
...@@ -325,7 +327,8 @@ ...@@ -325,7 +327,8 @@
class="inline-input w-50" class="inline-input w-50"
placeholder="字体段间距" placeholder="字体段间距"
@select="handleSelect('paragraphSpace')" @select="handleSelect('paragraphSpace')"
@blur="handleSelect('paragraphSpace')"> @blur="handleSelect('paragraphSpace')"
@keyup.enter="handleSelect('paragraphSpace')">
<template #suffix> <template #suffix>
<IconVerticalSpacingBetweenItems /> <IconVerticalSpacingBetweenItems />
</template> </template>
...@@ -352,7 +355,8 @@ ...@@ -352,7 +355,8 @@
class="inline-input w-50" class="inline-input w-50"
placeholder="字体字间距" placeholder="字体字间距"
@select="handleSelect('wordSpace')" @select="handleSelect('wordSpace')"
@blur="handleSelect('wordSpace')"> @blur="handleSelect('wordSpace')"
@keyup.enter="handleSelect('wordSpace')">
<template #suffix> <template #suffix>
<IconFullwidth /> <IconFullwidth />
</template> </template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment