From 8b5a7e08a90d4d4fda0f496bc4b5edaa72f797de Mon Sep 17 00:00:00 2001 From: miroiu Date: Sat, 11 May 2024 15:00:36 +0300 Subject: [PATCH 1/2] Added Orientation dependecy property to NodeInput and NodeOutput --- CHANGELOG.md | 1 + .../Editor/NodifyEditorView.xaml | 154 +++++++++--------- Nodify/Nodes/NodeInput.cs | 8 + Nodify/Nodes/NodeOutput.cs | 10 +- Nodify/Nodify.csproj | 2 + Nodify/Themes/Styles/NodeInput.xaml | 9 +- Nodify/Themes/Styles/NodeOutput.xaml | 9 +- 7 files changed, 110 insertions(+), 83 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb9d4860..d5ff3762 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ > - Added DrawDirectionalArrowsGeometry and DrawDirectionalArrowheadGeometry to BaseConnection to allow customizing the directional arrows > - Improved EditorGestures to allow changing input gestures at runtime > - Added new gesture types: AnyGesture, AllGestures, and InputGestureRef +> - Added Orientation dependency property to NodeInput and NodeOutput > - Bugfixes: > - Fixed BaseConnection.Text not always displaying in the center of the connection > - Fixed a bug where the item container would incorrectly transition to the dragging state on mouse over diff --git a/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml b/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml index cbc5f7bd..eb55485a 100644 --- a/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml +++ b/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml @@ -47,74 +47,74 @@ - - - - + + + + - + - - - + + + - - - + + + - - - + + + - + - @@ -314,7 +314,7 @@ - @@ -323,10 +323,7 @@ - + @@ -346,12 +343,14 @@ Value="{Binding Anchor, Mode=OneWayToSource}" /> + @@ -400,10 +401,7 @@ - - - - + @@ -419,11 +417,7 @@ - - - - + diff --git a/Nodify/Nodes/NodeInput.cs b/Nodify/Nodes/NodeInput.cs index 1652eb20..56bcac15 100644 --- a/Nodify/Nodes/NodeInput.cs +++ b/Nodify/Nodes/NodeInput.cs @@ -13,6 +13,7 @@ public class NodeInput : Connector public static readonly DependencyProperty HeaderProperty = HeaderedContentControl.HeaderProperty.AddOwner(typeof(NodeInput)); public static readonly DependencyProperty HeaderTemplateProperty = HeaderedContentControl.HeaderTemplateProperty.AddOwner(typeof(NodeInput)); public static readonly DependencyProperty ConnectorTemplateProperty = DependencyProperty.Register(nameof(ConnectorTemplate), typeof(ControlTemplate), typeof(NodeInput)); + public static readonly DependencyProperty OrientationProperty = StackPanel.OrientationProperty.AddOwner(typeof(NodeInput), new FrameworkPropertyMetadata(Orientation.Horizontal, FrameworkPropertyMetadataOptions.AffectsMeasure)); /// /// Gets of sets the data used for the control's header. @@ -41,6 +42,13 @@ public ControlTemplate ConnectorTemplate set => SetValue(ConnectorTemplateProperty, value); } + /// + public Orientation Orientation + { + get => (Orientation)GetValue(OrientationProperty); + set => SetValue(OrientationProperty, value); + } + #endregion static NodeInput() diff --git a/Nodify/Nodes/NodeOutput.cs b/Nodify/Nodes/NodeOutput.cs index a455a709..40f96b0e 100644 --- a/Nodify/Nodes/NodeOutput.cs +++ b/Nodify/Nodes/NodeOutput.cs @@ -13,7 +13,8 @@ public class NodeOutput : Connector public static readonly DependencyProperty HeaderProperty = HeaderedContentControl.HeaderProperty.AddOwner(typeof(NodeOutput)); public static readonly DependencyProperty HeaderTemplateProperty = HeaderedContentControl.HeaderTemplateProperty.AddOwner(typeof(NodeOutput)); public static readonly DependencyProperty ConnectorTemplateProperty = NodeInput.ConnectorTemplateProperty.AddOwner(typeof(NodeOutput)); - + public static readonly DependencyProperty OrientationProperty = NodeInput.OrientationProperty.AddOwner(typeof(NodeOutput), new FrameworkPropertyMetadata(Orientation.Horizontal, FrameworkPropertyMetadataOptions.AffectsMeasure)); + /// /// Gets of sets the data used for the control's header. /// @@ -41,6 +42,13 @@ public ControlTemplate ConnectorTemplate set => SetValue(ConnectorTemplateProperty, value); } + /// + public Orientation Orientation + { + get => (Orientation)GetValue(OrientationProperty); + set => SetValue(OrientationProperty, value); + } + #endregion static NodeOutput() diff --git a/Nodify/Nodify.csproj b/Nodify/Nodify.csproj index 8cf13982..85da0b5f 100644 --- a/Nodify/Nodify.csproj +++ b/Nodify/Nodify.csproj @@ -23,12 +23,14 @@ > - Added source and target parameters to GetTextPosition in BaseConnection > - EditorGestures is now a singleton instead of a static class (can be inherited from to create custom mappings) > - Selection gestures for ItemContainer and GroupingNode are now separated from the NodifyEditor selection gestures + > - Renamed EditorGestures.Editor.Zoom to ZoomModifierKey > - Features: > - Added SourceOrientation and TargetOrientation to BaseConnection to support vertical connectors (vertical/mixed connection orientation) > - Added DirectionalArrowsCount to BaseConnection to allow drawing multipe arrows on a connection flowing in the connection direction > - Added DrawDirectionalArrowsGeometry and DrawDirectionalArrowheadGeometry to BaseConnection to allow customizing the directional arrows > - Improved EditorGestures to allow changing input gestures at runtime > - Added new gesture types: AnyGesture, AllGestures and InputGestureRef + > - Added Orientation dependency property to NodeInput and NodeOutput > - Bugfixes: > - Fixed BaseConnection.Text not always displaying in the center of the connection > - Fixed a bug where the item container would incorrectly transition to the dragging state on mouse over diff --git a/Nodify/Themes/Styles/NodeInput.xaml b/Nodify/Themes/Styles/NodeInput.xaml index 2d50c102..42e53411 100644 --- a/Nodify/Themes/Styles/NodeInput.xaml +++ b/Nodify/Themes/Styles/NodeInput.xaml @@ -44,7 +44,7 @@ OpacityMask="{StaticResource FadeOpacityMask}" Background="{TemplateBinding BorderBrush}" /> - + + + + - @@ -60,6 +60,13 @@ + + + + Date: Sat, 11 May 2024 15:06:09 +0300 Subject: [PATCH 2/2] Fixed whitespaces --- .../Editor/NodifyEditorView.xaml | 134 +++++++++--------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml b/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml index eb55485a..2ce72e1b 100644 --- a/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml +++ b/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml @@ -47,74 +47,74 @@ - - - - + + + + - + - - - + + + - - - + + + - - - + + + - + - @@ -314,7 +314,7 @@ - @@ -350,7 +350,7 @@