From a4d69b1df06d8c04938f93c1a106b9be4424c6af Mon Sep 17 00:00:00 2001 From: miroiu Date: Fri, 26 Jul 2024 21:22:36 +0300 Subject: [PATCH 1/3] Added CuttingLine control to Nodify --- CHANGELOG.md | 4 + Examples/Nodify.Calculator/MainWindow.xaml.cs | 3 +- .../Editor/NodifyEditorView.xaml | 15 +- Examples/Nodify.Playground/EditorInputMode.cs | 13 +- Examples/Nodify.Playground/EditorSettings.cs | 24 +++ Examples/Nodify.Shapes/MainWindow.xaml.cs | 1 + Examples/Nodify.StateMachine/MainWindow.xaml | 1 + .../Nodify.StateMachine/MainWindow.xaml.cs | 3 + Nodify/Connections/BaseConnection.cs | 68 ++++--- Nodify/Connections/CircuitConnection.cs | 1 + Nodify/Connections/Connection.cs | 1 + Nodify/Connections/CuttingLine.cs | 79 ++++++++ Nodify/Connections/LineConnection.cs | 1 + Nodify/Connections/StepConnection.cs | 1 + Nodify/EditorGestures.cs | 11 + Nodify/EditorStates/EditorCuttingState.cs | 101 +++++++++ Nodify/EditorStates/EditorDefaultState.cs | 6 +- Nodify/Helpers/DependencyObjectExtensions.cs | 27 +++ Nodify/Helpers/UnscaleTransformConverter.cs | 17 +- Nodify/NodifyEditor.cs | 191 +++++++++++++++++- Nodify/Themes/Brushes.xaml | 8 + Nodify/Themes/Controls.xaml | 14 +- Nodify/Themes/Dark.xaml | 1 + Nodify/Themes/Light.xaml | 1 + Nodify/Themes/Nodify.xaml | 1 + Nodify/Themes/Styles/Connection.xaml | 21 +- Nodify/Themes/Styles/Controls.xaml | 1 + Nodify/Themes/Styles/CuttingLine.xaml | 16 ++ Nodify/Themes/Styles/NodifyEditor.xaml | 49 ++++- 29 files changed, 622 insertions(+), 58 deletions(-) create mode 100644 Nodify/Connections/CuttingLine.cs create mode 100644 Nodify/EditorStates/EditorCuttingState.cs create mode 100644 Nodify/Themes/Styles/CuttingLine.xaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a55e9ae..20f0a271 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,11 @@ > - Breaking Changes: > - Features: +> - Added a CuttingLine control that removes intersecting connections +> - Added CuttingLineStyle, CuttingStartedCommand, CuttingCompletedCommand, IsCutting, EnableCuttingLinePreview and CuttingConnectionTypes to NodifyEditor +> - Added EditorGestures.Editor.Cutting and EditorGestures.Editor.CancelAction > - Bugfixes: +> - Fixed connection styles not inheriting from the BaseConnection style #### **Version 6.2.0** diff --git a/Examples/Nodify.Calculator/MainWindow.xaml.cs b/Examples/Nodify.Calculator/MainWindow.xaml.cs index fc9ecc0e..1502d828 100644 --- a/Examples/Nodify.Calculator/MainWindow.xaml.cs +++ b/Examples/Nodify.Calculator/MainWindow.xaml.cs @@ -1,5 +1,4 @@ using System.Windows; -using System.Windows.Input; namespace Nodify.Calculator { @@ -8,6 +7,8 @@ public partial class MainWindow : Window public MainWindow() { InitializeComponent(); + + EditorGestures.Mappings.Editor.Cutting.Value = MultiGesture.None; } } } diff --git a/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml b/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml index 5873f9f4..4219332b 100644 --- a/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml +++ b/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml @@ -56,7 +56,8 @@ Duration="0:0:0.3" From="1" To="0.3" /> - + + @@ -189,7 +199,8 @@ DisplayConnectionsOnTop="{Binding DisplayConnectionsOnTop, Source={x:Static local:EditorSettings.Instance}}" BringIntoViewSpeed="{Binding BringIntoViewSpeed, Source={x:Static local:EditorSettings.Instance}}" BringIntoViewMaxDuration="{Binding BringIntoViewMaxDuration, Source={x:Static local:EditorSettings.Instance}}" - SelectionRectangleStyle="{StaticResource SelectionRectangleStyle}"> + SelectionRectangleStyle="{StaticResource SelectionRectangleStyle}" + CuttingLineStyle="{StaticResource CuttingLineStyle}"> + + + + + + - - - + + \ No newline at end of file diff --git a/Nodify/Themes/Styles/NodifyEditor.xaml b/Nodify/Themes/Styles/NodifyEditor.xaml index 10e8b344..81c51612 100644 --- a/Nodify/Themes/Styles/NodifyEditor.xaml +++ b/Nodify/Themes/Styles/NodifyEditor.xaml @@ -4,7 +4,8 @@ - + + @@ -58,9 +59,10 @@ IsItemsHost="True" Extent="{Binding ItemsExtent, Mode=OneWayToSource, RelativeSource={RelativeSource TemplatedParent}}" /> - + +``` + +## Customization + +The `CuttingLineStyle` is used to customize the cutting line: + +```xml + + + +``` diff --git a/docs/Minimap-Overview.md b/docs/Minimap-Overview.md index 72d4b432..85075aa4 100644 --- a/docs/Minimap-Overview.md +++ b/docs/Minimap-Overview.md @@ -58,7 +58,7 @@ The `ViewportStyle` is used to customize the viewport rectangle. - + ``` The `MaxViewportOffset` property is used to restrict how far the viewport can be moved away from the items when [panning](#panning). diff --git a/docs/_Sidebar.md b/docs/_Sidebar.md index f170fcbc..514d0d4a 100644 --- a/docs/_Sidebar.md +++ b/docs/_Sidebar.md @@ -47,6 +47,12 @@ - [NodeInput and NodeOutput](Connectors-Overview#nodeinput-and-nodeoutput) +[CuttingLine overview](CuttingLine-Overview) + +- [Enabling preview](CuttingLine-Overview#enabling-preview) +- [Custom connections](CuttingLine-Overview#custom-connections) +- [Customization](CuttingLine-Overview#customization) + [Minimap overview](Minimap-Overview) - [Moving the viewport](Minimap-Overview#panning)