Fix jumpy chat tab

This commit is contained in:
Mari the Deer 2022-06-22 12:41:02 +02:00
commit b0b9e291f6
2 changed files with 7 additions and 3 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.2.29 \cu(Wed 22 Jun 01:52:57 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.2.29 \cu(2022-06-22 01:52:57)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.2.28 r2 \cu(Wed 22 Jun 23:39:42 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.2.28 r2 \cu(2022-06-22 23:39:42)\c-";

View file

@ -6,12 +6,14 @@ Class DemolitionistChatTab : DemolitionistMenuTab
int ofs, maxofs;
double smofs;
bool drag;
bool justopened;
SWWMFullHistory hist;
override DemolitionistMenuTab Init( DemolitionistMenu master )
{
title = StringTable.Localize("$SWWM_CHATTAB");
hist = SWWMFullHistory.Get();
justopened = true;
return Super.Init(master);
}
@ -24,6 +26,7 @@ Class DemolitionistChatTab : DemolitionistMenuTab
override void OnSelect()
{
smofs = ofs;
justopened = true;
}
override void OnDeselect()
{
@ -76,7 +79,8 @@ Class DemolitionistChatTab : DemolitionistMenuTab
if ( recenter ) ofs = maxofs;
// update smooth scroll
smofs = (smofs*.6)+(ofs*.4);
if ( abs(smofs-ofs) < (1./master.hs) ) smofs = ofs;
if ( (abs(smofs-ofs) < (1./master.hs)) || justopened ) smofs = ofs;
justopened = false;
// tick the list (not really needed, as elements don't dynamically update anything)
msglist.Ticker();
}