Skip to content

Commit fb300ad

Browse files
committed
Slider fixes
1 parent e54b82f commit fb300ad

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

packages/app/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class WebdriverIODevtoolsApplication extends Element {
7676
? html`<wdio-devtools-sidebar style="${this.#drag?.getPosition()}"></wdio-devtools-sidebar>`
7777
: nothing
7878
}
79-
${this.#drag.getSlider('h-full')}
79+
${this.#drag.getSlider('z-10 h-full')}
8080
<wdio-devtools-workbench class="basis-auto"></wdio-devtools-workbench>
8181
</section>
8282
`

packages/app/src/components/workbench.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,11 @@ export class DevtoolsWorkbench extends Element {
9393
const heightWorkbench = this.#toolbarCollapsed ? 'h-full flex-1' : ''
9494

9595
const styleWorkbench = this.#toolbarCollapsed ? '' : (() => {
96-
const HANDLE_HEIGHT = 10
9796
const m = this.#dragVertical.getPosition().match(/(\d+(?:\.\d+)?)px/)
9897
const raw = m ? parseFloat(m[1]) : window.innerHeight * 0.7
9998
const capped = Math.min(raw, window.innerHeight * 0.7)
100-
const paneHeight = Math.max(MIN_WORKBENCH_HEIGHT, capped - HANDLE_HEIGHT)
101-
return `flex:0 0 ${paneHeight}px; height:${paneHeight}px; max-height:calc(70vh - ${HANDLE_HEIGHT}px); min-height:0;`
99+
const paneHeight = Math.max(MIN_WORKBENCH_HEIGHT, capped)
100+
return `flex:0 0 ${paneHeight}px; height:${paneHeight}px; max-height:70vh; min-height:0;`
102101
})()
103102

104103
const sidebarStyle = !this.#workbenchSidebarCollapsed
@@ -111,7 +110,7 @@ export class DevtoolsWorkbench extends Element {
111110
: ''
112111

113112
return html`
114-
<section data-horizontal-resizer-window class="flex w-full ${heightWorkbench} min-h-0 overflow-hidden" style="${styleWorkbench}">
113+
<section data-horizontal-resizer-window class="flex relative w-full ${heightWorkbench} min-h-0 overflow-hidden" style="${styleWorkbench}">
115114
<section data-sidebar class="flex-none" style="${sidebarStyle}">
116115
<wdio-devtools-tabs cacheId="activeActionsTab" class="h-full flex flex-col border-r-[1px] border-r-panelBorder ${this.#workbenchSidebarCollapsed ? 'hidden' : ''}">
117116
<wdio-devtools-tab label="Actions">
@@ -137,12 +136,12 @@ export class DevtoolsWorkbench extends Element {
137136
: nothing
138137
}
139138
</section>
140-
${!this.#workbenchSidebarCollapsed ? this.#dragHorizontal.getSlider() : nothing}
139+
${!this.#workbenchSidebarCollapsed ? this.#dragHorizontal.getSlider('z-30') : nothing}
141140
<section class="basis-auto text-gray-500 flex items-center justify-center flex-grow">
142141
<wdio-devtools-browser></wdio-devtools-browser>
143142
</section>
144143
</section>
145-
${!this.#toolbarCollapsed ? this.#dragVertical.getSlider() : nothing}
144+
${!this.#toolbarCollapsed ? this.#dragVertical.getSlider('z-20') : nothing}
146145
<wdio-devtools-tabs cacheId="activeWorkbenchTab" class="border-t-[1px] border-t-panelBorder ${this.#toolbarCollapsed ? 'hidden' : ''} flex-1 min-h-0">
147146
<wdio-devtools-tab label="Source">
148147
<wdio-devtools-source></wdio-devtools-source>

packages/app/src/utils/DragController.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class DragController implements ReactiveController {
105105
return this.#host.shadowRoot!.querySelector(`button[data-draggable-id="${this.#id}"]`)
106106
}
107107

108-
#setPosition(x: number, y: number) { // <<< MODIFY to clamp max
108+
#setPosition(x: number, y: number) {
109109
if (this.#options.direction === Direction.horizontal) {
110110
let nx = Math.max(x, this.#options.minPosition || 0)
111111
if (this.#options.maxPosition !== undefined) nx = Math.min(nx, this.#options.maxPosition)
@@ -241,7 +241,7 @@ export class DragController implements ReactiveController {
241241
data-draggable-id=${this.#id}
242242
data-dragging=${this.#state}
243243
style=${styleMap({ [anchor]: `${this.#getPosition() - 3}px` })}
244-
class="absolute z-10 ${className}"></button>
244+
class="absolute ${className}"></button>
245245
`
246246
}
247247

@@ -253,7 +253,7 @@ export class DragController implements ReactiveController {
253253

254254
const slidingElem = (draggableEl.parentElement || this.#host.shadowRoot)?.querySelector(`*[style="${this.getPosition()}"]`)
255255
if (!slidingElem) {
256-
return console.log(`Could not find element to adjust position with style "${this.getPosition()}"`)
256+
return
257257
}
258258
const rect = slidingElem.getBoundingClientRect()
259259
const direction = this.#options.direction === Direction.horizontal

0 commit comments

Comments
 (0)