mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-26 14:38:34 +01:00
ceil sizes to avoid one-pixel gaps between components on some scales
This commit is contained in:
parent
90d04b8c57
commit
b19333d627
2 changed files with 3 additions and 3 deletions
|
@ -326,8 +326,8 @@ namespace MLEM.Ui.Elements {
|
||||||
|
|
||||||
protected virtual Point CalcActualSize(Rectangle parentArea) {
|
protected virtual Point CalcActualSize(Rectangle parentArea) {
|
||||||
return new Point(
|
return new Point(
|
||||||
(this.size.X > 1 ? this.ScaledSize.X : parentArea.Width * this.size.X).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).Floor());
|
(this.size.Y > 1 ? this.ScaledSize.Y : parentArea.Height * this.size.Y).Ceil());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Rectangle GetAreaForAutoAnchors() {
|
protected virtual Rectangle GetAreaForAutoAnchors() {
|
||||||
|
|
|
@ -125,7 +125,7 @@ namespace MLEM.Ui.Elements {
|
||||||
var scrollerOffset = new Point(
|
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.Width - this.ScrollerSize.X * this.Scale)).Floor(),
|
||||||
this.Horizontal ? 0 : (this.currValue / this.maxValue * (this.DisplayArea.Height - this.ScrollerSize.Y * 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);
|
batch.Draw(this.ScrollerTexture, scrollerRect, Color.White * alpha, this.Scale);
|
||||||
base.Draw(time, batch, alpha);
|
base.Draw(time, batch, alpha);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue