1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-26 10:19:22 +01:00

Made Image ScaleToImage take ui scale into account

This commit is contained in:
Ell 2021-10-29 17:11:45 +02:00
parent e40d97c45e
commit 9ddc1f6975
2 changed files with 3 additions and 1 deletions

View file

@ -25,6 +25,7 @@ Additions
Improvements
- Cache TokenizedString inner offsets for non-Left text alignments to improve performance
- Exposed the epsilon value used by Element calculations
- Made Image ScaleToImage take ui scale into account
Fixes
- Fixed VerticalSpace height parameter being an integer

View file

@ -43,6 +43,7 @@ namespace MLEM.Ui.Elements {
private bool scaleToImage;
/// <summary>
/// Whether this image element's <see cref="Element.Size"/> should be based on the size of the <see cref="TextureRegion"/> given.
/// Note that, when scaling to the image's size, the <see cref="Element.Scale"/> is also taken into account.
/// </summary>
public bool ScaleToImage {
get => this.scaleToImage;
@ -97,7 +98,7 @@ namespace MLEM.Ui.Elements {
/// <inheritdoc />
protected override Vector2 CalcActualSize(RectangleF parentArea) {
return this.Texture != null && this.scaleToImage ? this.Texture.Size.ToVector2() : base.CalcActualSize(parentArea);
return this.Texture != null && this.scaleToImage ? this.Texture.Size.ToVector2() * this.Scale : base.CalcActualSize(parentArea);
}
/// <inheritdoc />