Browse Source

address review

pull/5042/head
Jumar Macato 6 years ago
parent
commit
538b723c2d
No known key found for this signature in database GPG Key ID: B19884DAC3A5BF3F
  1. 28
      src/Avalonia.Visuals/Media/PathFigure.cs

28
src/Avalonia.Visuals/Media/PathFigure.cs

@ -1,5 +1,5 @@
#nullable enable
using System;
using System.ComponentModel;
using Avalonia.Collections;
using Avalonia.Metadata;
@ -11,29 +11,35 @@ namespace Avalonia.Media
/// Defines the <see cref="IsClosed"/> property.
/// </summary>
public static readonly StyledProperty<bool> IsClosedProperty
= AvaloniaProperty.Register<PathFigure, bool>(nameof(IsClosed), true);
= AvaloniaProperty.Register<PathFigure, bool>(nameof(IsClosed), true);
/// <summary>
/// Defines the <see cref="IsFilled"/> property.
/// </summary>
public static readonly StyledProperty<bool> IsFilledProperty
= AvaloniaProperty.Register<PathFigure, bool>(nameof(IsFilled), true);
= AvaloniaProperty.Register<PathFigure, bool>(nameof(IsFilled), true);
/// <summary>
/// Defines the <see cref="Segments"/> property.
/// </summary>
public static readonly DirectProperty<PathFigure, PathSegments> SegmentsProperty
= AvaloniaProperty.RegisterDirect<PathFigure, PathSegments>(nameof(Segments), f => f.Segments, (f, s) => f.Segments = s);
= AvaloniaProperty.RegisterDirect<PathFigure, PathSegments>(nameof(Segments), f => f.Segments,
(f, s) => f.Segments = s);
/// <summary>
/// Defines the <see cref="StartPoint"/> property.
/// </summary>
public static readonly StyledProperty<Point> StartPointProperty
= AvaloniaProperty.Register<PathFigure, Point>(nameof(StartPoint));
= AvaloniaProperty.Register<PathFigure, Point>(nameof(StartPoint));
internal event EventHandler? SegmentsInvalidated;
internal event EventHandler SegmentsInvalidated;
private PathSegments? _segments;
private IDisposable _segmentsDisposable;
private IDisposable? _segmentsDisposable;
private IDisposable? _segmentsPropertiesDisposable;
private IDisposable _segmentsPropertiesDisposable;
/// <summary>
/// Initializes a new instance of the <see cref="PathFigure"/> class.
/// </summary>
@ -57,7 +63,7 @@ namespace Avalonia.Media
_ => InvalidateSegments(),
_ => InvalidateSegments(),
InvalidateSegments);
_segmentsPropertiesDisposable = _segments?.TrackItemPropertyChanged(_ => InvalidateSegments());
}
@ -127,8 +133,6 @@ namespace Avalonia.Media
ctx.EndFigure(IsClosed);
}
private PathSegments _segments;
public override string ToString()
=> $"M {StartPoint} {string.Join(" ", _segments)}{(IsClosed ? "Z" : "")}";
}

Loading…
Cancel
Save