1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 14:38:34 +01:00

only do updates if necessary

This commit is contained in:
Ellpeck 2019-08-10 15:12:27 +02:00
parent 519ac01b9e
commit 53f0858239

View file

@ -17,6 +17,8 @@ namespace MLEM.Ui.Elements {
public Anchor Anchor { public Anchor Anchor {
get => this.anchor; get => this.anchor;
set { set {
if (this.anchor == value)
return;
this.anchor = value; this.anchor = value;
this.SetDirty(); this.SetDirty();
} }
@ -24,6 +26,8 @@ namespace MLEM.Ui.Elements {
public Vector2 Size { public Vector2 Size {
get => this.size; get => this.size;
set { set {
if (this.size == value)
return;
this.size = value; this.size = value;
this.SetDirty(); this.SetDirty();
} }
@ -31,6 +35,8 @@ namespace MLEM.Ui.Elements {
public Point PositionOffset { public Point PositionOffset {
get => this.offset; get => this.offset;
set { set {
if (this.offset == value)
return;
this.offset = value; this.offset = value;
this.SetDirty(); this.SetDirty();
} }
@ -38,6 +44,8 @@ namespace MLEM.Ui.Elements {
public Point Padding { public Point Padding {
get => this.padding; get => this.padding;
set { set {
if (this.padding == value)
return;
this.padding = value; this.padding = value;
this.SetDirty(); this.SetDirty();
} }
@ -45,6 +53,8 @@ namespace MLEM.Ui.Elements {
public Point ChildPadding { public Point ChildPadding {
get => this.childPadding; get => this.childPadding;
set { set {
if (this.childPadding == value)
return;
this.childPadding = value; this.childPadding = value;
this.SetDirty(); this.SetDirty();
} }
@ -62,6 +72,8 @@ namespace MLEM.Ui.Elements {
public bool IsHidden { public bool IsHidden {
get => this.isHidden; get => this.isHidden;
set { set {
if (this.isHidden == value)
return;
this.isHidden = value; this.isHidden = value;
this.SetDirty(); this.SetDirty();
} }
@ -131,7 +143,7 @@ namespace MLEM.Ui.Elements {
public void SetDirty() { public void SetDirty() {
this.areaDirty = true; this.areaDirty = true;
if (this.Parent != null) if (this.Anchor >= Anchor.AutoLeft && this.Parent != null)
this.Parent.SetDirty(); this.Parent.SetDirty();
} }