mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-12-25 09:49:23 +01:00
fixed SetWidth/HeightBasedOnAspect behaving unexpectedly if an image has no texture
This commit is contained in:
parent
60af21aff4
commit
5d4f1293c7
1 changed files with 6 additions and 0 deletions
|
@ -144,6 +144,12 @@ namespace MLEM.Ui.Elements {
|
|||
ret.X = ret.Y * this.Texture.Width / this.Texture.Height + this.ScaledAutoSizeAddedAbsolute.X;
|
||||
if (this.SetHeightBasedOnAspect)
|
||||
ret.Y = ret.X * this.Texture.Height / this.Texture.Width + this.ScaledAutoSizeAddedAbsolute.Y;
|
||||
} else {
|
||||
// if we don't have a texture and we auto-set width or height, calculate as if we had a texture with a size of 0
|
||||
if (this.SetWidthBasedOnAspect)
|
||||
ret.X = this.ScaledAutoSizeAddedAbsolute.X;
|
||||
if (this.SetHeightBasedOnAspect)
|
||||
ret.Y = this.ScaledAutoSizeAddedAbsolute.Y;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue