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

@@ -123,17 +123,28 @@ class TpVSplitter extends LitElement {
document.body.style['userSelect'] = '';
this.dragging = false;
let finalWidth;
let finalLeftWidth;
if (this.lateResize && this._bufferedDelta) {
finalWidth = this._leftWidth + this._bufferedDelta;
finalLeftWidth = this._leftWidth + this._bufferedDelta;
this.splitter.style.transform = '';
this.style.gridTemplateColumns = `${finalWidth}px 5px 1fr`;
this.style.gridTemplateColumns = `${finalLeftWidth}px 5px 1fr`;
this._bufferedDelta = 0;
} else {
finalWidth = this.left.offsetWidth;
finalLeftWidth = this.left.offsetWidth;
}
this.dispatchEvent(new CustomEvent('resize-done', { detail: finalWidth, bubbles: true, composed: true }));
// Calculate right width
const splitterWidth = parseInt(getComputedStyle(this).getPropertyValue('--tp-splitter-width')) || 5;
const finalRightWidth = this.offsetWidth - finalLeftWidth - splitterWidth;
this.dispatchEvent(new CustomEvent('resize-done', {
detail: {
leftWidth: finalLeftWidth,
rightWidth: finalRightWidth
},
bubbles: true,
composed: true
}));
}
_resize(e) {