internal override bool UpdateSubTree() { if (!base.UpdateSubTree()) { return(false); } if (!autoSize.EnsureValid()) { autoSize.Refresh(delegate { Vector2 b = DrawQuadForBounds.BottomRight; InternalSize = new Vector2((RelativeSizeAxes & Axes.X) > 0 ? InternalSize.X : b.X, (RelativeSizeAxes & Axes.Y) > 0 ? InternalSize.Y : b.Y); Invalidate(Invalidation.Position); //note that this is called before autoSize becomes valid. may be something to consider down the line. //might work better to add an OnRefresh event in Cached<> and invoke there. OnAutoSize?.Invoke(); return(b); }); } return(true); }
private void updateAutoSize() { isComputingAutosize = true; try { if (autoSize.EnsureValid()) { return; } autoSize.Refresh(delegate { Vector2 b = computeAutoSize() + Padding.Total; if ((RelativeSizeAxes & Axes.X) == 0) { base.Width = b.X; } if ((RelativeSizeAxes & Axes.Y) == 0) { base.Height = b.Y; } //note that this is called before autoSize becomes valid. may be something to consider down the line. //might work better to add an OnRefresh event in Cached<> and invoke there. OnAutoSize?.Invoke(); }); } finally { isComputingAutosize = false; } }
internal override void UpdateSubTree() { base.UpdateSubTree(); if (!autoSize.IsValid) { autoSize.Refresh(delegate { Vector2 b = DrawQuadForBounds.BottomRight; size = new Vector2((SizeMode & InheritMode.X) > 0 ? Size.X : b.X, (SizeMode & InheritMode.Y) > 0 ? Size.Y : b.Y); Invalidate(Invalidation.Position); //note that this is called before autoSize becomes valid. may be something to consider down the line. //might work better to add an OnRefresh event in Cached<> and invoke there. OnAutoSize?.Invoke(); return(b); }); } }