fix ScrollBar flickering: -1 is used as a sentinel value, but is a valid coordinate

simplify
This commit is contained in:
Glenn Maynard
2004-08-14 20:18:34 +00:00
parent 646b3fee12
commit c4aadc69e3
+8 -15
View File
@@ -61,8 +61,8 @@ void ScrollBar::SetPercentage( float fStartPercent, float fEndPercent )
{
iPart1TopY = (int)SCALE( fStartPercent,0.0f, 1.0f, -iBarContentHeight/2.0f, +iBarContentHeight/2.0f );
iPart1BottomY = (int)SCALE( fEndPercent, 0.0f, 1.0f, -iBarContentHeight/2.0f, +iBarContentHeight/2.0f );
iPart2TopY = -1;
iPart2BottomY = -1;
iPart2TopY = 0;
iPart2BottomY = 0;
}
else // we need two thumb parts
{
@@ -82,19 +82,12 @@ void ScrollBar::SetPercentage( float fStartPercent, float fEndPercent )
) );
CHECKPOINT;
if( iPart2TopY != -1 )
{
m_sprScrollThumbPart2.StretchTo( RectI(
(int)-m_sprScrollThumbPart2.GetUnzoomedWidth()/2,
iPart2TopY,
(int)+m_sprScrollThumbPart2.GetUnzoomedWidth()/2,
iPart2BottomY
) );
}
else
{
m_sprScrollThumbPart2.SetZoomY( 0 );
}
m_sprScrollThumbPart2.StretchTo( RectI(
(int)-m_sprScrollThumbPart2.GetUnzoomedWidth()/2,
iPart2TopY,
(int)+m_sprScrollThumbPart2.GetUnzoomedWidth()/2,
iPart2BottomY
) );
CHECKPOINT;
}