Skip to content

Commit 2588eaf

Browse files
committed
Fix for horizontal slider
1 parent b98b30b commit 2588eaf

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

packages/app/src/components/workbench.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export class DevtoolsWorkbench extends Element {
3232
display: flex;
3333
flex-direction: column;
3434
flex-grow: 1;
35+
height: 100vh;
36+
min-height: 0;
37+
overflow: hidden;
3538
color: var(--vscode-foreground);
3639
background-color: var(--vscode-editor-background);
3740
position: relative;
@@ -85,19 +88,30 @@ export class DevtoolsWorkbench extends Element {
8588
horizontalResizerWindow?: HTMLElement
8689

8790
render() {
88-
const heightWorkbench = this.#toolbarCollapsed ? 'h-full' : 'h-[70%]'
89-
const styleWorkbench = this.#toolbarCollapsed ? '' : this.#dragVertical.getPosition()
91+
// When collapsed keep previous full behavior; when expanded no fixed height class
92+
const heightWorkbench = this.#toolbarCollapsed ? 'h-full flex-1' : ''
93+
94+
// Convert the drag position (e.g. "top: 334px") into a concrete height
95+
const styleWorkbench = this.#toolbarCollapsed ? '' : (() => {
96+
const HANDLE_HEIGHT = 10
97+
const m = this.#dragVertical.getPosition().match(/(\d+(?:\.\d+)?)px/)
98+
const raw = m ? parseFloat(m[1]) : window.innerHeight * 0.7
99+
const paneHeight = raw + HANDLE_HEIGHT
100+
const capped = Math.min(paneHeight, window.innerHeight * 0.7)
101+
return `flex:0 0 auto; flex-basis:${capped}px; height:${capped}px; max-height:70vh; min-height:0;`
102+
})()
103+
90104
const sidebarStyle = !this.#workbenchSidebarCollapsed
91105
? (() => {
92106
const pos = this.#dragHorizontal.getPosition()
93107
const m = pos.match(/flex-basis:\s*([\d.]+)px/)
94108
const w = m ? m[1] : MIN_METATAB_WIDTH
95-
// Keep drag-resize (flex-basis) but stop auto-expansion
96109
return `${pos}; flex:0 0 auto; min-width:${w}px; max-width:${w}px;`
97110
})()
98111
: ''
112+
99113
return html`
100-
<section data-horizontal-resizer-window class="flex w-full ${heightWorkbench} flex-1" style="${styleWorkbench}">
114+
<section data-horizontal-resizer-window class="flex w-full ${heightWorkbench} min-h-0 overflow-hidden" style="${styleWorkbench}">
101115
<section data-sidebar class="flex-none" style="${sidebarStyle}">
102116
<wdio-devtools-tabs cacheId="activeActionsTab" class="h-full flex flex-col border-r-[1px] border-r-panelBorder ${this.#workbenchSidebarCollapsed ? 'hidden' : ''}">
103117
<wdio-devtools-tab label="Actions">
@@ -128,7 +142,8 @@ export class DevtoolsWorkbench extends Element {
128142
</section>
129143
${!this.#workbenchSidebarCollapsed ? this.#dragHorizontal.getSlider() : nothing}
130144
</section>
131-
<wdio-devtools-tabs cacheId="activeWorkbenchTab" class="border-t-[1px] border-t-panelBorder ${this.#toolbarCollapsed ? 'hidden' : ''}">
145+
${!this.#toolbarCollapsed ? this.#dragVertical.getSlider() : nothing}
146+
<wdio-devtools-tabs cacheId="activeWorkbenchTab" class="border-t-[1px] border-t-panelBorder ${this.#toolbarCollapsed ? 'hidden' : ''} flex-1 min-h-0">
132147
<wdio-devtools-tab label="Source">
133148
<wdio-devtools-source></wdio-devtools-source>
134149
</wdio-devtools-tab>
@@ -157,7 +172,6 @@ export class DevtoolsWorkbench extends Element {
157172
`
158173
: nothing
159174
}
160-
${!this.#toolbarCollapsed ? this.#dragVertical.getSlider() : nothing}
161175
`
162176
}
163177
}

0 commit comments

Comments
 (0)