Skip to content

Commit eef0948

Browse files
authored
fix(hub-ui): account for panel offsets when resizing
Subtract the panel left/top offset for mouse input as well as touch input when dragging the right or bottom edge.
1 parent 44566b0 commit eef0948

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎packages/hub-ui/src/client/components/dock/DockPanelResizer.vue‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function handleResize(e: MouseEvent | TouchEvent) {
4848
4949
let widthPx: number, heightPx: number
5050
if (resizingState.value.right) {
51-
widthPx = Math.abs(e instanceof MouseEvent ? e.clientX : (e.touches[0]?.clientX || 0) - (box?.left || 0))
51+
widthPx = Math.abs((e instanceof MouseEvent ? e.clientX : (e.touches[0]?.clientX || 0)) - (box?.left || 0))
5252
store.width = Math.min(PANEL_MAX, Math.max(PANEL_MIN, widthPx / window.innerWidth * 100))
5353
}
5454
else if (resizingState.value.left) {
@@ -61,7 +61,7 @@ function handleResize(e: MouseEvent | TouchEvent) {
6161
store.height = Math.min(PANEL_MAX, Math.max(PANEL_MIN, heightPx / window.innerHeight * 100))
6262
}
6363
else if (resizingState.value.bottom) {
64-
heightPx = Math.abs(e instanceof MouseEvent ? e.clientY : (e.touches[0]?.clientY || 0) - (box?.top || 0))
64+
heightPx = Math.abs((e instanceof MouseEvent ? e.clientY : (e.touches[0]?.clientY || 0)) - (box?.top || 0))
6565
store.height = Math.min(PANEL_MAX, Math.max(PANEL_MIN, heightPx / window.innerHeight * 100))
6666
}
6767
}

0 commit comments

Comments
 (0)