Skip to content

Commit

Permalink
fixed #437
Browse files Browse the repository at this point in the history
  • Loading branch information
NaBian committed Jul 14, 2020
1 parent 7969435 commit 25a6117
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ protected override Size MeasureOverride(Size availableSize)

#region Calc AvailableSize

_childGraph.Reset();
_childGraph.Reset(false);
var boundingSize = _childGraph.GetBoundingSize(Width.IsNaN(), Height.IsNaN());
_childGraph.Reset();
_childGraph.Measure(boundingSize);
Expand Down Expand Up @@ -284,17 +284,21 @@ public GraphNode(UIElement element)

public void Arrange(Size arrangeSize) => Element.Arrange(new Rect(Left, Top, Math.Max(arrangeSize.Width - Left - Right, 0), Math.Max(arrangeSize.Height - Top - Bottom, 0)));

public void Reset()
public void Reset(bool clearPos)
{
Left = double.NaN;
Top = double.NaN;
Right = double.NaN;
Bottom = double.NaN;
if (clearPos)
{
Left = double.NaN;
Top = double.NaN;
Right = double.NaN;
Bottom = double.NaN;
}
Measured = false;
}

public Size GetBoundingSize()
{
if (Left < 0 || Top < 0) return default;
if (Measured) return BoundingSize;

if (!OutgoingNodes.Any())
Expand Down Expand Up @@ -373,7 +377,7 @@ public void Clear()
_nodeDic.Clear();
}

public void Reset() => _nodeDic.Values.Do(node => node.Reset());
public void Reset(bool clearPos = true) => _nodeDic.Values.Do(node => node.Reset(clearPos));

public GraphNode AddLink(GraphNode from, UIElement to)
{
Expand Down

0 comments on commit 25a6117

Please sign in to comment.