1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-24 01:09:23 +01:00

fixed elements sometimes not notifying their auto-adjusting parents

This commit is contained in:
Ellpeck 2019-12-29 15:18:49 +01:00
parent fb48386aad
commit 31d805fc04
2 changed files with 3 additions and 1 deletions

View file

@ -212,7 +212,7 @@ namespace MLEM.Ui.Elements {
public void SetAreaDirty() {
this.areaDirty = true;
if (this.Anchor >= Anchor.AutoLeft && this.Parent != null)
if (this.Parent != null && (this.Anchor >= Anchor.AutoLeft || this.Parent.SetWidthBasedOnChildren || this.Parent.SetHeightBasedOnChildren))
this.Parent.SetAreaDirty();
}

View file

@ -35,6 +35,7 @@ namespace MLEM.Ui.Elements {
public override void Update(GameTime time) {
base.Update(time);
this.SnapPositionToMouse();
this.UpdateAreaIfDirty();
}
public override void ForceUpdateArea() {
@ -64,5 +65,6 @@ namespace MLEM.Ui.Elements {
offset.Y = (viewport.Y - this.Area.Height) / this.Scale;
this.PositionOffset = offset;
}
}
}