mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-12-25 01:39:23 +01:00
added ScaleOrigin to RootElement
This commit is contained in:
parent
95917e08d6
commit
b0309c9707
2 changed files with 10 additions and 1 deletions
|
@ -71,7 +71,7 @@ namespace MLEM.Ui.Elements {
|
|||
/// <param name="scale">The scale to use</param>
|
||||
/// <param name="origin">The origin to use for scaling, or null to use this element's center point</param>
|
||||
public void ScaleOrigin(float scale, Vector2? origin = null) {
|
||||
this.Transform = Matrix.CreateScale(scale, scale, 0) * Matrix.CreateTranslation(new Vector3((1 - scale) * (origin ?? this.DisplayArea.Center), 0));
|
||||
this.Transform = Matrix.CreateScale(scale, scale, 1) * Matrix.CreateTranslation(new Vector3((1 - scale) * (origin ?? this.DisplayArea.Center), 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -442,5 +442,14 @@ namespace MLEM.Ui {
|
|||
this.System.Controls.SelectElement(this, element, autoNav);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scales this root element's <see cref="Transform"/> matrix based on the given scale and origin.
|
||||
/// </summary>
|
||||
/// <param name="scale">The scale to use</param>
|
||||
/// <param name="origin">The origin to use for scaling, or null to use this root's element's center point</param>
|
||||
public void ScaleOrigin(float scale, Vector2? origin = null) {
|
||||
this.Transform = Matrix.CreateScale(scale, scale, 1) * Matrix.CreateTranslation(new Vector3((1 - scale) * (origin ?? this.Element.DisplayArea.Center), 0));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue