From 9ed8b6a9205ea0a8b72068e5319784c39a3683a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wies=C5=82aw=20S=CC=8Colte=CC=81s?= Date: Fri, 17 Mar 2023 09:50:14 +0100 Subject: [PATCH] Refactor DrawingNode template --- .../NodeEditor.Base/Views/ToolboxView.axaml | 2 +- src/NodeEditorAvalonia/Controls/Connectors.cs | 7 ++ src/NodeEditorAvalonia/Controls/Node.cs | 2 +- src/NodeEditorAvalonia/Controls/Nodes.cs | 7 ++ src/NodeEditorAvalonia/Controls/Pins.cs | 7 ++ .../Themes/Connectors.axaml | 40 +++++++++++ .../Themes/DrawingNode.axaml | 61 +--------------- src/NodeEditorAvalonia/Themes/Node.axaml | 53 +------------- .../Themes/NodeEditorTheme.axaml | 7 +- src/NodeEditorAvalonia/Themes/Nodes.axaml | 55 +++++++++++++++ src/NodeEditorAvalonia/Themes/Pins.axaml | 70 +++++++++++++++++++ 11 files changed, 197 insertions(+), 114 deletions(-) create mode 100644 src/NodeEditorAvalonia/Controls/Connectors.cs create mode 100644 src/NodeEditorAvalonia/Controls/Nodes.cs create mode 100644 src/NodeEditorAvalonia/Controls/Pins.cs create mode 100644 src/NodeEditorAvalonia/Themes/Connectors.axaml create mode 100644 src/NodeEditorAvalonia/Themes/Nodes.axaml create mode 100644 src/NodeEditorAvalonia/Themes/Pins.axaml diff --git a/samples/NodeEditor.Base/Views/ToolboxView.axaml b/samples/NodeEditor.Base/Views/ToolboxView.axaml index c4248e3..17b1196 100644 --- a/samples/NodeEditor.Base/Views/ToolboxView.axaml +++ b/samples/NodeEditor.Base/Views/ToolboxView.axaml @@ -41,7 +41,7 @@ - diff --git a/src/NodeEditorAvalonia/Controls/Connectors.cs b/src/NodeEditorAvalonia/Controls/Connectors.cs new file mode 100644 index 0000000..d0d6dd8 --- /dev/null +++ b/src/NodeEditorAvalonia/Controls/Connectors.cs @@ -0,0 +1,7 @@ +using Avalonia.Controls.Primitives; + +namespace NodeEditor.Controls; + +public class Connectors : TemplatedControl +{ +} diff --git a/src/NodeEditorAvalonia/Controls/Node.cs b/src/NodeEditorAvalonia/Controls/Node.cs index d65326c..c6d9425 100644 --- a/src/NodeEditorAvalonia/Controls/Node.cs +++ b/src/NodeEditorAvalonia/Controls/Node.cs @@ -6,4 +6,4 @@ namespace NodeEditor.Controls; [PseudoClasses(":selected")] public class Node : TemplatedControl { -} \ No newline at end of file +} diff --git a/src/NodeEditorAvalonia/Controls/Nodes.cs b/src/NodeEditorAvalonia/Controls/Nodes.cs new file mode 100644 index 0000000..0ae989a --- /dev/null +++ b/src/NodeEditorAvalonia/Controls/Nodes.cs @@ -0,0 +1,7 @@ +using Avalonia.Controls.Primitives; + +namespace NodeEditor.Controls; + +public class Nodes : TemplatedControl +{ +} diff --git a/src/NodeEditorAvalonia/Controls/Pins.cs b/src/NodeEditorAvalonia/Controls/Pins.cs new file mode 100644 index 0000000..5542044 --- /dev/null +++ b/src/NodeEditorAvalonia/Controls/Pins.cs @@ -0,0 +1,7 @@ +using Avalonia.Controls.Primitives; + +namespace NodeEditor.Controls; + +public class Pins : TemplatedControl +{ +} diff --git a/src/NodeEditorAvalonia/Themes/Connectors.axaml b/src/NodeEditorAvalonia/Themes/Connectors.axaml new file mode 100644 index 0000000..0298392 --- /dev/null +++ b/src/NodeEditorAvalonia/Themes/Connectors.axaml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/NodeEditorAvalonia/Themes/DrawingNode.axaml b/src/NodeEditorAvalonia/Themes/DrawingNode.axaml index dde6cd0..4a31e1e 100644 --- a/src/NodeEditorAvalonia/Themes/DrawingNode.axaml +++ b/src/NodeEditorAvalonia/Themes/DrawingNode.axaml @@ -1,9 +1,6 @@  @@ -27,64 +24,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + diff --git a/src/NodeEditorAvalonia/Themes/Node.axaml b/src/NodeEditorAvalonia/Themes/Node.axaml index 8ed4b15..911299e 100644 --- a/src/NodeEditorAvalonia/Themes/Node.axaml +++ b/src/NodeEditorAvalonia/Themes/Node.axaml @@ -1,8 +1,6 @@  @@ -18,53 +16,10 @@ Height="{Binding Height}"> - - - - - - - - - - - - - - - - - + - - - - diff --git a/src/NodeEditorAvalonia/Themes/NodeEditorTheme.axaml b/src/NodeEditorAvalonia/Themes/NodeEditorTheme.axaml index b2645cc..d4fa31c 100644 --- a/src/NodeEditorAvalonia/Themes/NodeEditorTheme.axaml +++ b/src/NodeEditorAvalonia/Themes/NodeEditorTheme.axaml @@ -16,9 +16,12 @@ - - + + + + + diff --git a/src/NodeEditorAvalonia/Themes/Nodes.axaml b/src/NodeEditorAvalonia/Themes/Nodes.axaml new file mode 100644 index 0000000..99c5a34 --- /dev/null +++ b/src/NodeEditorAvalonia/Themes/Nodes.axaml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/NodeEditorAvalonia/Themes/Pins.axaml b/src/NodeEditorAvalonia/Themes/Pins.axaml new file mode 100644 index 0000000..ce36413 --- /dev/null +++ b/src/NodeEditorAvalonia/Themes/Pins.axaml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +