mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-25 01:39:57 +08:00
fix(editor): 拖动改变左右列宽,不能让中间区域宽度小于0
This commit is contained in:
parent
e01d5d913f
commit
0444f68f3a
@ -74,8 +74,13 @@ const center = ref(0);
|
|||||||
|
|
||||||
const changeLeft = (deltaX: number) => {
|
const changeLeft = (deltaX: number) => {
|
||||||
if (typeof props.left === 'undefined') return;
|
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);
|
emit('update:left', left);
|
||||||
|
|
||||||
|
if (clientWidth - left - (props.right || 0) <= 0) {
|
||||||
|
left = props.left;
|
||||||
|
}
|
||||||
|
|
||||||
center.value = clientWidth - left - (props.right || 0);
|
center.value = clientWidth - left - (props.right || 0);
|
||||||
|
|
||||||
emit('change', {
|
emit('change', {
|
||||||
@ -87,8 +92,13 @@ const changeLeft = (deltaX: number) => {
|
|||||||
|
|
||||||
const changeRight = (deltaX: number) => {
|
const changeRight = (deltaX: number) => {
|
||||||
if (typeof props.right === 'undefined') return;
|
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);
|
emit('update:right', right);
|
||||||
|
|
||||||
|
if (clientWidth - (props.left || 0) - right <= 0) {
|
||||||
|
right = props.right;
|
||||||
|
}
|
||||||
|
|
||||||
center.value = clientWidth - (props.left || 0) - right;
|
center.value = clientWidth - (props.left || 0) - right;
|
||||||
|
|
||||||
emit('change', {
|
emit('change', {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user