From 0444f68f3a34615b5cb5d978fdec9d959d8d8a3b Mon Sep 17 00:00:00 2001 From: roymondchen Date: Wed, 12 Oct 2022 17:54:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20=E6=8B=96=E5=8A=A8=E6=94=B9?= =?UTF-8?q?=E5=8F=98=E5=B7=A6=E5=8F=B3=E5=88=97=E5=AE=BD=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E8=AE=A9=E4=B8=AD=E9=97=B4=E5=8C=BA=E5=9F=9F=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6=E5=B0=8F=E4=BA=8E0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor/src/layouts/Layout.vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/editor/src/layouts/Layout.vue b/packages/editor/src/layouts/Layout.vue index 0fc38997..9a037308 100644 --- a/packages/editor/src/layouts/Layout.vue +++ b/packages/editor/src/layouts/Layout.vue @@ -74,8 +74,13 @@ const center = ref(0); const changeLeft = (deltaX: number) => { if (typeof props.left === 'undefined') return; - const left = Math.max(props.left + deltaX, props.minLeft) || 0; + let left = Math.max(props.left + deltaX, props.minLeft) || 0; emit('update:left', left); + + if (clientWidth - left - (props.right || 0) <= 0) { + left = props.left; + } + center.value = clientWidth - left - (props.right || 0); emit('change', { @@ -87,8 +92,13 @@ const changeLeft = (deltaX: number) => { const changeRight = (deltaX: number) => { if (typeof props.right === 'undefined') return; - const right = Math.max(props.right - deltaX, props.minRight) || 0; + let right = Math.max(props.right - deltaX, props.minRight) || 0; emit('update:right', right); + + if (clientWidth - (props.left || 0) - right <= 0) { + right = props.right; + } + center.value = clientWidth - (props.left || 0) - right; emit('change', {