Fix jumpy chat tab
This commit is contained in:
parent
2b93403ff0
commit
be96487e29
2 changed files with 7 additions and 3 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue