Tell the page when the chat changes height
The Scheduler sizes the views above the panel from what the chat leaves, so a chat that resizes silently grew off the bottom and took its own composer with it.
This commit is contained in:
@@ -365,6 +365,9 @@ vv_ai_profiles_script();
|
|||||||
// conversation, or the page retargeting. A page holding its own copy of "which profile" has
|
// conversation, or the page retargeting. A page holding its own copy of "which profile" has
|
||||||
// no other way to stay in step with a menu it does not own.
|
// no other way to stay in step with a menu it does not own.
|
||||||
const onProfile = o.onProfile || function () {};
|
const onProfile = o.onProfile || function () {};
|
||||||
|
// Called with the new state when the operator expands or collapses, for a page that has to
|
||||||
|
// re-lay itself out around the new height. See the grow handler.
|
||||||
|
const onResize = o.onResize || function () {};
|
||||||
const store = o.chats !== false;
|
const store = o.chats !== false;
|
||||||
const POLL_MS = 1200;
|
const POLL_MS = 1200;
|
||||||
const POLL_CEIL = 300000; // stop polling a worker that never wrote a terminal state
|
const POLL_CEIL = 300000; // stop polling a worker that never wrote a terminal state
|
||||||
@@ -872,7 +875,20 @@ vv_ai_profiles_script();
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (growBtn) {
|
if (growBtn) {
|
||||||
growBtn.addEventListener('click', () => { big = !big; applyHeights(); scroll(); });
|
// onResize fires only here, on the operator's own toggle — never from setHeights(). A page
|
||||||
|
// whose layout depends on this height calls setHeights() from inside its fit routine, so
|
||||||
|
// announcing it there would call that routine from within itself, forever.
|
||||||
|
//
|
||||||
|
// A placement that is not simply taller than its neighbours has to be told. The Scheduler
|
||||||
|
// panel is pinned at the bottom and the views above it are sized from what is left, so
|
||||||
|
// without this the chat grows downward off the end of the panel and takes its own composer
|
||||||
|
// with it — which is precisely what it did.
|
||||||
|
growBtn.addEventListener('click', () => {
|
||||||
|
big = !big;
|
||||||
|
applyHeights();
|
||||||
|
scroll();
|
||||||
|
onResize(big);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Surface any script error into the transcript. Without it a throw anywhere on the page is
|
// Surface any script error into the transcript. Without it a throw anywhere on the page is
|
||||||
|
|||||||
@@ -2400,6 +2400,9 @@ if (document.getElementById('vv-sched-ai-chat')) {
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
onTurn: () => { vvAiFixArm(); requestAnimationFrame(vvFitRight); },
|
onTurn: () => { vvAiFixArm(); requestAnimationFrame(vvFitRight); },
|
||||||
|
// Expanding changes how much of the panel is left for the views above it. Without this the
|
||||||
|
// chat grows downward past the end of the panel instead of upward into it.
|
||||||
|
onResize: () => requestAnimationFrame(vvFitRight),
|
||||||
onOffer: (kind, yes) => { if (kind === 'fix') vvAiFixAnswer(yes); },
|
onOffer: (kind, yes) => { if (kind === 'fix') vvAiFixAnswer(yes); },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user