mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-25 22:18:34 +01:00
Made Image ScaleToImage take ui scale into account
This commit is contained in:
parent
e40d97c45e
commit
9ddc1f6975
2 changed files with 3 additions and 1 deletions
|
@ -25,6 +25,7 @@ Additions
|
||||||
Improvements
|
Improvements
|
||||||
- Cache TokenizedString inner offsets for non-Left text alignments to improve performance
|
- Cache TokenizedString inner offsets for non-Left text alignments to improve performance
|
||||||
- Exposed the epsilon value used by Element calculations
|
- Exposed the epsilon value used by Element calculations
|
||||||
|
- Made Image ScaleToImage take ui scale into account
|
||||||
|
|
||||||
Fixes
|
Fixes
|
||||||
- Fixed VerticalSpace height parameter being an integer
|
- Fixed VerticalSpace height parameter being an integer
|
||||||
|
|
|
@ -43,6 +43,7 @@ namespace MLEM.Ui.Elements {
|
||||||
private bool scaleToImage;
|
private bool scaleToImage;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this image element's <see cref="Element.Size"/> should be based on the size of the <see cref="TextureRegion"/> given.
|
/// 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>
|
/// </summary>
|
||||||
public bool ScaleToImage {
|
public bool ScaleToImage {
|
||||||
get => this.scaleToImage;
|
get => this.scaleToImage;
|
||||||
|
@ -97,7 +98,7 @@ namespace MLEM.Ui.Elements {
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override Vector2 CalcActualSize(RectangleF parentArea) {
|
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 />
|
/// <inheritdoc />
|
||||||
|
|
Loading…
Reference in a new issue