Browse Source

fix nullable implementation.

pull/4252/head
Dan Walmsley 6 years ago
parent
commit
70c71263ae
  1. 27
      src/Avalonia.Controls/RelativePanel.cs

27
src/Avalonia.Controls/RelativePanel.cs

@ -1,4 +1,4 @@
/// Ported from https://github.com/HandyOrg/HandyControl/blob/master/src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs // Ported from https://github.com/HandyOrg/HandyControl/blob/master/src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -14,7 +14,6 @@ namespace Avalonia.Controls
public RelativePanel() => _childGraph = new Graph(); public RelativePanel() => _childGraph = new Graph();
private Layoutable? GetDependencyElement(AvaloniaProperty property, AvaloniaObject child) private Layoutable? GetDependencyElement(AvaloniaProperty property, AvaloniaObject child)
{ {
var dependency = child.GetValue(property); var dependency = child.GetValue(property);
@ -100,25 +99,25 @@ namespace Avalonia.Controls
public HashSet<GraphNode> OutgoingNodes { get; } public HashSet<GraphNode> OutgoingNodes { get; }
public GraphNode AlignLeftWithNode { get; set; } public GraphNode? AlignLeftWithNode { get; set; }
public GraphNode AlignTopWithNode { get; set; } public GraphNode? AlignTopWithNode { get; set; }
public GraphNode AlignRightWithNode { get; set; } public GraphNode? AlignRightWithNode { get; set; }
public GraphNode AlignBottomWithNode { get; set; } public GraphNode? AlignBottomWithNode { get; set; }
public GraphNode LeftOfNode { get; set; } public GraphNode? LeftOfNode { get; set; }
public GraphNode AboveNode { get; set; } public GraphNode? AboveNode { get; set; }
public GraphNode RightOfNode { get; set; } public GraphNode? RightOfNode { get; set; }
public GraphNode BelowNode { get; set; } public GraphNode? BelowNode { get; set; }
public GraphNode AlignHorizontalCenterWith { get; set; } public GraphNode? AlignHorizontalCenterWith { get; set; }
public GraphNode AlignVerticalCenterWith { get; set; } public GraphNode? AlignVerticalCenterWith { get; set; }
public GraphNode(Layoutable element) public GraphNode(Layoutable element)
{ {
@ -220,7 +219,7 @@ namespace Avalonia.Controls
public void Reset() => _nodeDic.Values.Do(node => node.Reset()); public void Reset() => _nodeDic.Values.Do(node => node.Reset());
public GraphNode AddLink(GraphNode from, Layoutable to) public GraphNode? AddLink(GraphNode from, Layoutable? to)
{ {
if (to == null) if (to == null)
return null; return null;
@ -258,7 +257,7 @@ namespace Avalonia.Controls
Measure(_nodeDic.Values, null); Measure(_nodeDic.Values, null);
} }
private void Measure(IEnumerable<GraphNode> nodes, HashSet<AvaloniaObject> set) private void Measure(IEnumerable<GraphNode> nodes, HashSet<AvaloniaObject>? set)
{ {
set ??= new HashSet<AvaloniaObject>(); set ??= new HashSet<AvaloniaObject>();

Loading…
Cancel
Save