Size the Scheduler panel from the height the dock reports, not one read mid-animation
.vv-ai-chat transitions its height, so measuring the dock straight after setting it returns the height it is animating away from — the view was cut short for a dock that had already shrunk, leaving the difference as dead panel underneath.
This commit is contained in:
@@ -1262,6 +1262,7 @@ function vvFitRight() {
|
||||
// the same 1:2 relationship, or on a very short viewport the two states would clamp to the same
|
||||
// number and the control would appear to do nothing.
|
||||
const dock = document.getElementById('vv-ai-dock');
|
||||
let dockH = dock ? dock.offsetHeight : 0;
|
||||
if (vvSchedChat && dock) {
|
||||
// The share is of the transcript, but what the panel has to find room for is the whole
|
||||
// assistant — composer, control row, padding. Measured rather than assumed, because it is a
|
||||
@@ -1274,12 +1275,21 @@ function vvFitRight() {
|
||||
// discussed on screen too; a chat that covers it entirely is not worth the room it took.
|
||||
const VIEW_MIN = 90;
|
||||
const room = Math.max(60, availH - VIEW_MIN - chrome);
|
||||
vvSchedChat.setHeights(Math.min(room, Math.max(52, Math.round(availH * 0.10))) + 'px',
|
||||
Math.min(room, Math.max(100, Math.round(availH * 0.20))) + 'px',
|
||||
Math.min(room, Math.max(140, Math.round(availH * 0.40))) + 'px');
|
||||
const applied =
|
||||
vvSchedChat.setHeights(Math.min(room, Math.max(52, Math.round(availH * 0.10))) + 'px',
|
||||
Math.min(room, Math.max(100, Math.round(availH * 0.20))) + 'px',
|
||||
Math.min(room, Math.max(140, Math.round(availH * 0.40))) + 'px');
|
||||
// Taken from what setHeights() reports, not from measuring the dock again. The transcript
|
||||
// animates its height, so offsetHeight here returns what it is animating away from — a figure
|
||||
// that was right a frame ago and is wrong by the difference between the two states. Sizing the
|
||||
// view from it cut the view short and left that difference as dead panel below the dock, which
|
||||
// only an expand/collapse cleared because that is what ran the fit again once the box settled.
|
||||
//
|
||||
// chrome is safe to have measured against the same animating box: it is the difference between
|
||||
// the dock and the transcript inside it, so the moving term cancels out of the subtraction.
|
||||
if (applied != null) dockH = chrome + applied;
|
||||
else dockH = dock.offsetHeight;
|
||||
}
|
||||
// Measured after the heights are applied, so this reads the clamped height, not the natural one.
|
||||
const dockH = dock ? dock.offsetHeight : 0;
|
||||
const contentH = Math.max(80, availH - dockH);
|
||||
if (pre.style.display !== 'none') {
|
||||
pre.style.maxHeight = 'none';
|
||||
|
||||
Reference in New Issue
Block a user