mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-10-31 21:00:51 +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;
|
ret.X = ret.Y * this.Texture.Width / this.Texture.Height + this.ScaledAutoSizeAddedAbsolute.X;
|
||||||
if (this.SetHeightBasedOnAspect)
|
if (this.SetHeightBasedOnAspect)
|
||||||
ret.Y = ret.X * this.Texture.Height / this.Texture.Width + this.ScaledAutoSizeAddedAbsolute.Y;
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue