FlatAnimatedIconTest: made animation of switch smooth on high scale factors

This commit is contained in:
Karl Tauber
2021-02-01 12:55:14 +01:00
parent b3c40bf448
commit eac7492143

View File

@@ -196,10 +196,10 @@ public class FlatAnimatedIconTest
g.fillRoundRect( x, y, width, height, height, height );
int thumbSize = height - 4;
int thumbX = x + 2 + Math.round( (width - 4 - thumbSize) * animatedValue );
float thumbX = x + 2 + ((width - 4 - thumbSize) * animatedValue);
int thumbY = y + 2;
g.setColor( Color.white );
g.fillOval( thumbX, thumbY, thumbSize, thumbSize );
((Graphics2D)g).fill( new Ellipse2D.Float( thumbX, thumbY, thumbSize, thumbSize ) );
}
@Override