1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-25 01:39:23 +01:00

ceil sizes to avoid one-pixel gaps between components on some scales

This commit is contained in:
Ellpeck 2019-09-05 11:46:07 +02:00
parent 90d04b8c57
commit b19333d627
2 changed files with 3 additions and 3 deletions

View file

@ -326,8 +326,8 @@ namespace MLEM.Ui.Elements {
protected virtual Point CalcActualSize(Rectangle parentArea) {
return new Point(
(this.size.X > 1 ? this.ScaledSize.X : parentArea.Width * this.size.X).Floor(),
(this.size.Y > 1 ? this.ScaledSize.Y : parentArea.Height * this.size.Y).Floor());
(this.size.X > 1 ? this.ScaledSize.X : parentArea.Width * this.size.X).Ceil(),
(this.size.Y > 1 ? this.ScaledSize.Y : parentArea.Height * this.size.Y).Ceil());
}
protected virtual Rectangle GetAreaForAutoAnchors() {

View file

@ -125,7 +125,7 @@ namespace MLEM.Ui.Elements {
var scrollerOffset = new Point(
!this.Horizontal ? 0 : (this.currValue / this.maxValue * (this.DisplayArea.Width - this.ScrollerSize.X * this.Scale)).Floor(),
this.Horizontal ? 0 : (this.currValue / this.maxValue * (this.DisplayArea.Height - this.ScrollerSize.Y * this.Scale)).Floor());
var scrollerRect = new Rectangle(scrollerPos + scrollerOffset, this.ScrollerSize.Multiply(this.Scale));
var scrollerRect = new Rectangle(scrollerPos + scrollerOffset, new Point((this.ScrollerSize.X * this.Scale).Ceil(), (this.ScrollerSize.Y * this.Scale).Ceil()));
batch.Draw(this.ScrollerTexture, scrollerRect, Color.White * alpha, this.Scale);
base.Draw(time, batch, alpha);
}