Return all widths and heights in the resize done event.

This commit is contained in:
2025-11-03 10:15:00 +01:00
parent 8383af2345
commit cea028c229
3 changed files with 33 additions and 11 deletions

View File

@@ -124,17 +124,28 @@ class TpHSplitter extends LitElement {
document.body.style['userSelect'] = '';
this.dragging = false;
let finalHeight;
let finalTopHeight;
if (this.lateResize && this._bufferedDelta) {
finalHeight = this._topHeight + this._bufferedDelta;
finalTopHeight = this._topHeight + this._bufferedDelta;
this.splitter.style.transform = '';
this.style.gridTemplateRows = `${finalHeight}px 5px 1fr`;
this.style.gridTemplateRows = `${finalTopHeight}px 5px 1fr`;
this._bufferedDelta = 0;
} else {
finalHeight = this.top.offsetHeight;
finalTopHeight = this.top.offsetHeight;
}
this.dispatchEvent(new CustomEvent('resize-done', { detail: finalHeight, bubbles: true, composed: true }));
// Calculate bottom height
const splitterWidth = parseInt(getComputedStyle(this).getPropertyValue('--tp-splitter-width')) || 5;
const finalBottomHeight = this.offsetHeight - finalTopHeight - splitterWidth;
this.dispatchEvent(new CustomEvent('resize-done', {
detail: {
topHeight: finalTopHeight,
bottomHeight: finalBottomHeight
},
bubbles: true,
composed: true
}));
}
_resize(e) {