diff --git a/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml b/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml
index 72deb346..9b219ffd 100644
--- a/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml
+++ b/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml
@@ -110,7 +110,7 @@
-
diff --git a/Nodify/Connections/LineConnection.cs b/Nodify/Connections/LineConnection.cs
index 5081339a..f49cbdd5 100644
--- a/Nodify/Connections/LineConnection.cs
+++ b/Nodify/Connections/LineConnection.cs
@@ -86,9 +86,9 @@ protected static Point InterpolateLineSegment(Point p0, Point p1, double t)
protected static ((Point SegmentStart, Point SegmentEnd), Point InterpolatedPoint) InterpolateLine(Point p0, Point p1, Point p2, Point p3, double t)
{
- double length1 = (p1 - p0).Length;
- double length2 = (p2 - p1).Length;
- double length3 = (p3 - p2).Length;
+ double length1 = (p1 - p0).Length();
+ double length2 = (p2 - p1).Length();
+ double length3 = (p3 - p2).Length();
double totalLength = length1 + length2 + length3;
double ratio1 = length1 / totalLength;
@@ -110,8 +110,8 @@ protected static ((Point SegmentStart, Point SegmentEnd), Point InterpolatedPoin
protected static ((Point SegmentStart, Point SegmentEnd), Point InterpolatedPoint) InterpolateLine(Point p0, Point p1, Point p2, double t)
{
- double length1 = (p1 - p0).Length;
- double length2 = (p2 - p1).Length;
+ double length1 = (p1 - p0).Length();
+ double length2 = (p2 - p1).Length();
double totalLength = length1 + length2;
double ratio1 = length1 / totalLength;
diff --git a/Nodify/Connections/StepConnection.cs b/Nodify/Connections/StepConnection.cs
index c97f7257..4f7d2283 100644
--- a/Nodify/Connections/StepConnection.cs
+++ b/Nodify/Connections/StepConnection.cs
@@ -15,8 +15,8 @@ public enum ConnectorPosition
public class StepConnection : LineConnection
{
- public static readonly DependencyProperty SourcePositionProperty = DependencyProperty.Register(nameof(SourcePosition), typeof(ConnectorPosition), typeof(StepConnection), new FrameworkPropertyMetadata(ConnectorPosition.Right, FrameworkPropertyMetadataOptions.AffectsRender, OnConnectorPositionChanged));
- public static readonly DependencyProperty TargetPositionProperty = DependencyProperty.Register(nameof(TargetPosition), typeof(ConnectorPosition), typeof(StepConnection), new FrameworkPropertyMetadata(ConnectorPosition.Left, FrameworkPropertyMetadataOptions.AffectsRender, OnConnectorPositionChanged));
+ public static readonly AvaloniaProperty SourcePositionProperty = AvaloniaProperty.Register(nameof(SourcePosition), ConnectorPosition.Right);
+ public static readonly AvaloniaProperty TargetPositionProperty = AvaloniaProperty.Register(nameof(TargetPosition), ConnectorPosition.Left);
private static void OnConnectorPositionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
@@ -28,12 +28,15 @@ private static void OnConnectorPositionChanged(DependencyObject d, DependencyPro
static StepConnection()
{
- SourceOrientationProperty.OverrideMetadata(typeof(StepConnection), new FrameworkPropertyMetadata(Orientation.Horizontal, null, CoerceSourceOrientation));
- TargetOrientationProperty.OverrideMetadata(typeof(StepConnection), new FrameworkPropertyMetadata(Orientation.Horizontal, null, CoerceTargetOrientation));
- DirectionProperty.OverrideMetadata(typeof(StepConnection), new FrameworkPropertyMetadata(ConnectionDirection.Forward, null, CoerceConnectionDirection));
+ SourcePositionProperty.Changed.AddClassHandler(OnConnectorPositionChanged);
+ TargetPositionProperty.Changed.AddClassHandler(OnConnectorPositionChanged);
+ AffectsRender(SourcePositionProperty, TargetPositionProperty);
+ SourceOrientationProperty.OverrideMetadata(new StyledPropertyMetadata(defaultValue: Orientation.Horizontal, coerce: CoerceSourceOrientation));
+ TargetOrientationProperty.OverrideMetadata(new StyledPropertyMetadata(defaultValue: Orientation.Horizontal, coerce: CoerceTargetOrientation));
+ DirectionProperty.OverrideMetadata(new StyledPropertyMetadata(defaultValue: ConnectionDirection.Forward, coerce: CoerceConnectionDirection));
}
- private static object CoerceSourceOrientation(DependencyObject d, object baseValue)
+ private static Orientation CoerceSourceOrientation(DependencyObject d, Orientation baseValue)
{
var connection = (StepConnection)d;
return connection.SourcePosition == ConnectorPosition.Left || connection.SourcePosition == ConnectorPosition.Right
@@ -41,7 +44,7 @@ private static object CoerceSourceOrientation(DependencyObject d, object baseVal
: Orientation.Vertical;
}
- private static object CoerceTargetOrientation(DependencyObject d, object baseValue)
+ private static Orientation CoerceTargetOrientation(DependencyObject d, Orientation baseValue)
{
var connection = (StepConnection)d;
return connection.TargetPosition == ConnectorPosition.Left || connection.TargetPosition == ConnectorPosition.Right
@@ -49,7 +52,7 @@ private static object CoerceTargetOrientation(DependencyObject d, object baseVal
: Orientation.Vertical;
}
- private static object CoerceConnectionDirection(DependencyObject d, object baseValue)
+ private static ConnectionDirection CoerceConnectionDirection(DependencyObject d, ConnectionDirection baseValue)
{
var connection = (StepConnection)d;
return connection.TargetPosition == ConnectorPosition.Left || connection.TargetPosition == ConnectorPosition.Top
@@ -116,7 +119,7 @@ protected override Point GetTextPosition(FormattedText text, Point source, Point
return new Point((p3.X + p2.X - text.Width) / 2, (p3.Y + p2.Y - text.Height) / 2);
static Vector GetMax(in Vector a, in Vector b)
- => a.LengthSquared > b.LengthSquared ? a : b;
+ => a.SquaredLength > b.SquaredLength ? a : b;
}
protected override void DrawDirectionalArrowsGeometry(StreamGeometryContext context, Point source, Point target)
diff --git a/Nodify/Themes/Brushes.xaml b/Nodify/Themes/Brushes.xaml
index ada034ab..828d8b4d 100644
--- a/Nodify/Themes/Brushes.xaml
+++ b/Nodify/Themes/Brushes.xaml
@@ -157,7 +157,6 @@
diff --git a/Nodify/Themes/Controls.xaml b/Nodify/Themes/Controls.xaml
index 3fa61fdd..47a5752f 100644
--- a/Nodify/Themes/Controls.xaml
+++ b/Nodify/Themes/Controls.xaml
@@ -178,13 +178,13 @@
-
+
diff --git a/Nodify/Themes/Styles/Connection.xaml b/Nodify/Themes/Styles/Connection.xaml
index 24100e70..50a3390b 100644
--- a/Nodify/Themes/Styles/Connection.xaml
+++ b/Nodify/Themes/Styles/Connection.xaml
@@ -35,7 +35,7 @@
Value="30" />
-
+
\ No newline at end of file
diff --git a/Nodify/Themes/Styles/DecoratorContainer.xaml b/Nodify/Themes/Styles/DecoratorContainer.xaml
index 30884514..26a10c79 100644
--- a/Nodify/Themes/Styles/DecoratorContainer.xaml
+++ b/Nodify/Themes/Styles/DecoratorContainer.xaml
@@ -2,8 +2,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Nodify">
-
-
diff --git a/Nodify/Themes/Styles/NodifyEditor.xaml b/Nodify/Themes/Styles/NodifyEditor.xaml
index 73b767c9..78d6520e 100644
--- a/Nodify/Themes/Styles/NodifyEditor.xaml
+++ b/Nodify/Themes/Styles/NodifyEditor.xaml
@@ -6,7 +6,7 @@
-
+