1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-06-14 01:50:44 +02:00

fixed scroll bars still ceiling their values

This commit is contained in:
Ellpeck 2019-11-02 22:38:44 +01:00
parent da04514d05
commit 7f81f6469f
2 changed files with 2 additions and 2 deletions

View file

@ -76,7 +76,7 @@ namespace MLEM.Ui.Elements {
var lowestChild = this.GetLowestChild(e => !e.IsHidden);
// the max value of the scrollbar is the amount of non-scaled pixels taken up by overflowing components
var childrenHeight = lowestChild.Area.Bottom - firstChild.Area.Top;
this.ScrollBar.MaxValue = ((childrenHeight - this.Area.Height) / this.Scale + this.ChildPadding.Y * 2).Ceil();
this.ScrollBar.MaxValue = (childrenHeight - this.Area.Height) / this.Scale + this.ChildPadding.Y * 2;
// update the render target
var targetArea = this.GetRenderTargetArea();

View file

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