From 877a4eaa49b6826e04426e162049db14f6a4f15e Mon Sep 17 00:00:00 2001 From: roymondchen Date: Mon, 10 Feb 2025 19:59:11 +0800 Subject: [PATCH] =?UTF-8?q?feat(editor):=20=E4=BC=98=E5=8C=96=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E5=8F=98=E5=B0=8F=E6=97=B6=E5=90=84=E5=88=97?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor/src/components/SplitView.vue | 23 +++++--- packages/editor/src/layouts/Framework.vue | 53 +++++++++---------- .../src/layouts/props-panel/PropsPanel.vue | 50 ++++++++++++++--- .../layouts/props-panel/use-style-panel.ts | 13 ++++- packages/editor/src/services/ui.ts | 10 +++- packages/editor/src/utils/const.ts | 5 ++ 6 files changed, 111 insertions(+), 43 deletions(-) create mode 100644 packages/editor/src/utils/const.ts diff --git a/packages/editor/src/components/SplitView.vue b/packages/editor/src/components/SplitView.vue index 9155d80e..70bfa1f0 100644 --- a/packages/editor/src/components/SplitView.vue +++ b/packages/editor/src/components/SplitView.vue @@ -45,7 +45,7 @@ const props = withDefaults( centerClass?: string; }>(), { - minLeft: 46, + minLeft: 1, minRight: 1, minCenter: 5, }, @@ -65,12 +65,21 @@ const getCenterWidth = (l = 0, r = 0) => { let center = clientWidth - left - right; if (center < props.minCenter) { + const diff = props.minCenter - center; + center = props.minCenter; - if (right > center + props.minRight) { - right = clientWidth - left - center; - } else { + + if (right - diff < props.minRight) { right = props.minRight; - left = clientWidth - right - center; + } else { + right -= diff; + } + + left = clientWidth - right - center; + + if (left < props.minLeft) { + left -= diff / 2; + right -= diff / 2; } } return { @@ -86,8 +95,8 @@ const widthChange = (width: number) => { } clientWidth = width; - let left = props.left || 0; - let right = props.right || 0; + let left = props.left || props.minLeft || 0; + let right = props.right || props.minRight || 0; if (left > clientWidth) { left = clientWidth / 3; diff --git a/packages/editor/src/layouts/Framework.vue b/packages/editor/src/layouts/Framework.vue index b2536fd1..9a72ad0c 100644 --- a/packages/editor/src/layouts/Framework.vue +++ b/packages/editor/src/layouts/Framework.vue @@ -1,5 +1,5 @@