mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-29 23:58:34 +01:00
some exception handling
This commit is contained in:
parent
150d6f771a
commit
03923f91f6
3 changed files with 9 additions and 5 deletions
|
@ -305,10 +305,12 @@ namespace MLEM.Ui.Elements {
|
||||||
|
|
||||||
if (this.SetHeightBasedOnChildren && this.Children.Count > 0) {
|
if (this.SetHeightBasedOnChildren && this.Children.Count > 0) {
|
||||||
var lowest = this.GetLowestChild(e => !e.IsHidden);
|
var lowest = this.GetLowestChild(e => !e.IsHidden);
|
||||||
var newHeight = (lowest.UnscrolledArea.Bottom - pos.Y + this.ScaledChildPadding.Y) / this.Scale;
|
if (lowest != null) {
|
||||||
if (newHeight != this.size.Y) {
|
var newHeight = (lowest.UnscrolledArea.Bottom - pos.Y + this.ScaledChildPadding.Y) / this.Scale;
|
||||||
this.size.Y = newHeight;
|
if (newHeight != this.size.Y) {
|
||||||
this.ForceUpdateArea();
|
this.size.Y = newHeight;
|
||||||
|
this.ForceUpdateArea();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace MLEM.Ui.Elements {
|
||||||
set {
|
set {
|
||||||
if (this.texture != value) {
|
if (this.texture != value) {
|
||||||
this.texture = value;
|
this.texture = value;
|
||||||
|
this.IsHidden = this.texture == null;
|
||||||
if (this.scaleToImage)
|
if (this.scaleToImage)
|
||||||
this.SetAreaDirty();
|
this.SetAreaDirty();
|
||||||
}
|
}
|
||||||
|
@ -42,7 +43,7 @@ namespace MLEM.Ui.Elements {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Point CalcActualSize(Rectangle parentArea) {
|
protected override Point CalcActualSize(Rectangle parentArea) {
|
||||||
return this.scaleToImage ? this.texture.Size : base.CalcActualSize(parentArea);
|
return this.texture != null && this.scaleToImage ? this.texture.Size : base.CalcActualSize(parentArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw(GameTime time, SpriteBatch batch, float alpha) {
|
public override void Draw(GameTime time, SpriteBatch batch, float alpha) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ namespace MLEM.Ui.Elements {
|
||||||
set {
|
set {
|
||||||
if (this.text != value) {
|
if (this.text != value) {
|
||||||
this.text = value;
|
this.text = value;
|
||||||
|
this.IsHidden = string.IsNullOrWhiteSpace(this.text);
|
||||||
this.SetAreaDirty();
|
this.SetAreaDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue