From fb79701886764302d00b66caf677fa743fabb333 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Sat, 1 Jun 2024 08:19:10 +0800 Subject: [PATCH 1/6] feat: dragging view area show view size --- src/SplitPane.vue | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/SplitPane.vue b/src/SplitPane.vue index 79d0aa73..28a74063 100644 --- a/src/SplitPane.vue +++ b/src/SplitPane.vue @@ -14,6 +14,8 @@ const showOutput = toRef(store, 'showOutput') const state = reactive({ dragging: false, split: 50, + viewHeight: 0, + viewWidth: 0, }) const boundSplit = computed(() => { @@ -38,6 +40,9 @@ function dragMove(e: MouseEvent) { : container.value.offsetWidth const dp = position - startPosition state.split = startSplit + +((dp / totalSize) * 100).toFixed(2) + const view = container.value.children[1] + state.viewHeight = view.offsetHeight + state.viewWidth = view.offsetWidth } } @@ -70,6 +75,9 @@ function dragEnd() { class="right" :style="{ [isVertical ? 'height' : 'width']: 100 - boundSplit + '%' }" > +
+ {{ `${state.viewWidth}px x ${state.viewHeight}px` }} +
@@ -97,6 +105,14 @@ function dragEnd() { position: relative; height: 100%; } +.view-size { + position: absolute; + top: 40px; + left: 10px; + font-size: 12px; + color: var(--text-light); + z-index: 100; +} .left { border-right: 1px solid var(--border); } From 478ce8b7f56e8aa40b4cc2ac309ca568719d2e8d Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Sun, 2 Jun 2024 07:27:17 +0800 Subject: [PATCH 2/6] feat: update --- src/SplitPane.vue | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/SplitPane.vue b/src/SplitPane.vue index 28a74063..68c98a9c 100644 --- a/src/SplitPane.vue +++ b/src/SplitPane.vue @@ -1,11 +1,12 @@