Commit 0cfa689c authored by 罗超's avatar 罗超

优化文本框不能超出文档底部

parent d58634e8
......@@ -8,6 +8,7 @@
width: elementInfo.width + 'px',
height: elementInfo.height + 'px',
}"
style="overflow: hidden;"
>
<div
class="rotate-wrapper"
......@@ -75,6 +76,7 @@ import useHistorySnapshot from '@/hooks/useHistorySnapshot'
import ElementOutline from '@/views/components/element/ElementOutline.vue'
import ProsemirrorEditor from '@/views/components/element/ProsemirrorEditor.vue'
import { VIEWPORT_SIZE, VIEWPORT_VER_SIZE } from '@/configs/canvas'
const props = defineProps<{
elementInfo: PPTTextElement
......@@ -132,11 +134,15 @@ const updateTextElementHeight = (entries: ResizeObserverEntry[]) => {
const contentRect = entries[0].contentRect
if (!elementRef.value) return
const realHeight = contentRect.height + 20
let realHeight = contentRect.height + 20
const realWidth = contentRect.width + 20
const documentHeight = useSlidesStore().viewportRatio>1?VIEWPORT_SIZE.Value:VIEWPORT_VER_SIZE.Value
if (!props.elementInfo.vertical && props.elementInfo.height !== realHeight) {
if (!isScaling.value) {
const maxHeight = documentHeight - props.elementInfo.top - 10
realHeight = realHeight<=maxHeight?realHeight:maxHeight
slidesStore.updateElement({
id: props.elementInfo.id,
props: { height: realHeight },
......
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