You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Creates a new element with the given anchor and size and sets up some default event reactions.
@@ -664,13 +665,22 @@ public void SetAreaDirty() {
664
665
this.AreaDirty=true;
665
666
this.System?.InvokeOnElementAreaDirty(this);
666
667
this.Parent?.OnChildAreaDirty(this,false);
668
+
foreach(varchildinthis.Children)
669
+
child.OnParentAreaDirty(this,false);
667
670
}
668
671
669
672
/// <summary>
670
673
/// Updates this element's <see cref="Area"/> and all of its <see cref="Children"/> by calling <see cref="ForceUpdateArea"/> if <see cref="AreaDirty"/> is true.
671
674
/// </summary>
672
675
/// <returns>Whether <see cref="AreaDirty"/> was true and <see cref="ForceUpdateArea"/> was called</returns>
673
676
publicboolUpdateAreaIfDirty(){
677
+
// ensure we are positioned correctly in our parent by updating its area if it is dirty.
678
+
// this ensures that area updates are correctly propagated even for elements that don't access their own areas while drawing or updating.
679
+
// if the parent's area was dirty and updated our area, our AreaDirty will have already been set to false before we reach the code below.
680
+
if(this.parentPotentiallyDirty){
681
+
this.parentPotentiallyDirty=false;
682
+
this.Parent?.UpdateAreaIfDirty();
683
+
}
674
684
if(this.AreaDirty){
675
685
this.ForceUpdateArea();
676
686
returntrue;
@@ -688,6 +698,7 @@ public virtual void ForceUpdateArea() {
688
698
return;
689
699
// if the parent's area is dirty, it would get updated anyway when querying its ChildPaddedArea,
690
700
// which would cause our ForceUpdateArea code to be run twice, so we only update our parent instead
0 commit comments