NANCY: Reset textbox scrollbar when adding new line

This commit is contained in:
Kaloyan Chehlarski 2023-10-05 21:09:51 +03:00
parent 3a72322d55
commit 4aa0727f95

View File

@ -173,6 +173,9 @@ void Textbox::addTextLine(const Common::String &text, uint32 autoClearTime) {
// Currently only used by inventory closed captions
_autoClearTime = g_nancy->getTotalPlayTime() + autoClearTime;
}
_scrollbar->resetPosition();
onScrollbarMove();
}
void Textbox::setOverrideFont(const uint fontID) {
@ -206,6 +209,9 @@ void Textbox::onScrollbarMove() {
}
uint16 Textbox::getInnerHeight() const {
// As early as nancy3 this behavior stopped being relevant, as the original
// engine always scrolls down to the bottom of the entire inner surface.
// However, that makes the scrollbar almost unusable, so I'm not changing this.
const TBOX *tbox = (const TBOX *)g_nancy->getEngineData("TBOX");
assert(tbox);