From 9afbfb0443d1e2c3330e25a3bbfac0e6662bd37e Mon Sep 17 00:00:00 2001 From: liam Date: Mon, 21 Dec 2020 11:46:46 -0800 Subject: [PATCH 01/10] Added custom Node control --- .idea/.idea.NodeEditor/.idea/.gitignore | 13 +++ .idea/.idea.NodeEditor/.idea/contentModel.xml | 9 +- .idea/.idea.NodeEditor/.idea/misc.xml | 6 ++ .idea/.idea.NodeEditor/.idea/modules.xml | 2 +- .idea/.idea.NodeEditor/.idea/workspace.xml | 89 ++++++++++++++++++- .idea/.idea.NodeEditor/riderModule.iml | 7 ++ Controls/Node.xaml | 12 +++ Controls/Node.xaml.cs | 55 ++++++++++++ NodeEditor.csproj | 7 ++ 9 files changed, 192 insertions(+), 8 deletions(-) create mode 100644 .idea/.idea.NodeEditor/.idea/.gitignore create mode 100644 .idea/.idea.NodeEditor/.idea/misc.xml create mode 100644 .idea/.idea.NodeEditor/riderModule.iml create mode 100644 Controls/Node.xaml create mode 100644 Controls/Node.xaml.cs diff --git a/.idea/.idea.NodeEditor/.idea/.gitignore b/.idea/.idea.NodeEditor/.idea/.gitignore new file mode 100644 index 0000000..391aacf --- /dev/null +++ b/.idea/.idea.NodeEditor/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/modules.xml +/contentModel.xml +/projectSettingsUpdater.xml +/.idea.NodeEditor.iml +# Datasource local storage ignored files +/../../../../../../../:\Users\Liam\NodeEditor\.idea\.idea.NodeEditor\.idea/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/.idea.NodeEditor/.idea/contentModel.xml b/.idea/.idea.NodeEditor/.idea/contentModel.xml index abfd5e9..0bffd39 100644 --- a/.idea/.idea.NodeEditor/.idea/contentModel.xml +++ b/.idea/.idea.NodeEditor/.idea/contentModel.xml @@ -1,9 +1,9 @@ - - - + + + @@ -12,6 +12,8 @@ + + @@ -28,6 +30,7 @@ + diff --git a/.idea/.idea.NodeEditor/.idea/misc.xml b/.idea/.idea.NodeEditor/.idea/misc.xml new file mode 100644 index 0000000..1d8c84d --- /dev/null +++ b/.idea/.idea.NodeEditor/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.NodeEditor/.idea/modules.xml b/.idea/.idea.NodeEditor/.idea/modules.xml index cb0411a..5dffea2 100644 --- a/.idea/.idea.NodeEditor/.idea/modules.xml +++ b/.idea/.idea.NodeEditor/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/.idea/.idea.NodeEditor/.idea/workspace.xml b/.idea/.idea.NodeEditor/.idea/workspace.xml index 510e3c8..c5e7aa6 100644 --- a/.idea/.idea.NodeEditor/.idea/workspace.xml +++ b/.idea/.idea.NodeEditor/.idea/workspace.xml @@ -3,11 +3,39 @@ NodeEditor.csproj + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + @@ -24,8 +64,10 @@ + + @@ -64,14 +106,53 @@ - + + + + + diff --git a/.idea/.idea.NodeEditor/riderModule.iml b/.idea/.idea.NodeEditor/riderModule.iml new file mode 100644 index 0000000..1a4e0d9 --- /dev/null +++ b/.idea/.idea.NodeEditor/riderModule.iml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Controls/Node.xaml b/Controls/Node.xaml new file mode 100644 index 0000000..1358e17 --- /dev/null +++ b/Controls/Node.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/Controls/Node.xaml.cs b/Controls/Node.xaml.cs new file mode 100644 index 0000000..4ce0e7a --- /dev/null +++ b/Controls/Node.xaml.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; +using System.Windows.Controls; +using System.Windows.Media; + +namespace NodeEditor.Controls +{ + /// + /// Interaction logic for Node.xaml + /// + public partial class Node : UserControl + { + public static List Nodes { get; } = new List(); + + // ReSharper disable once UnusedAutoPropertyAccessor.Global + public string Desc { get; set; } + + public Node() + { + Nodes.Add(this); + Name = GetIndexOf(this).ToString(); + Desc = ""; + InitializeComponent(); + } + public Node(string name) + { + Nodes.Add(this); + Name = name; + Desc = ""; + InitializeComponent(); + } + public Node(string name, string desc) + { + Nodes.Add(this); + Name = name; + Desc = desc; + InitializeComponent(); + } + + public static int GetIndexOf(Node node) + { + if (node != null) + return Nodes.IndexOf(node); + return -1; + } + + public void Destroy() + { + var parentObject = VisualTreeHelper.GetParent(this); + var parent = parentObject as Canvas; + + parent?.Children.Remove(this); + Nodes.Remove(this); + } + } +} diff --git a/NodeEditor.csproj b/NodeEditor.csproj index 60d1a9c..b17e1d8 100644 --- a/NodeEditor.csproj +++ b/NodeEditor.csproj @@ -65,6 +65,9 @@ EditorCanvas.xaml + + Node.xaml + @@ -72,6 +75,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer From 9ef2a57235544edee3356c9691d2687fa4ac3239 Mon Sep 17 00:00:00 2001 From: liam Date: Mon, 21 Dec 2020 12:31:06 -0800 Subject: [PATCH 02/10] Added Paths custom control and Modes enum. --- .idea/.idea.NodeEditor/.idea/contentModel.xml | 3 + .idea/.idea.NodeEditor/.idea/workspace.xml | 31 +++++-- Controls/Path.xaml | 12 +++ Controls/Path.xaml.cs | 87 +++++++++++++++++++ Extensions/Modes.cs | 12 +++ NodeEditor.csproj | 5 ++ 6 files changed, 144 insertions(+), 6 deletions(-) create mode 100644 Controls/Path.xaml create mode 100644 Controls/Path.xaml.cs create mode 100644 Extensions/Modes.cs diff --git a/.idea/.idea.NodeEditor/.idea/contentModel.xml b/.idea/.idea.NodeEditor/.idea/contentModel.xml index 0bffd39..38e1177 100644 --- a/.idea/.idea.NodeEditor/.idea/contentModel.xml +++ b/.idea/.idea.NodeEditor/.idea/contentModel.xml @@ -14,9 +14,12 @@ + + + diff --git a/.idea/.idea.NodeEditor/.idea/workspace.xml b/.idea/.idea.NodeEditor/.idea/workspace.xml index c5e7aa6..e2dffc2 100644 --- a/.idea/.idea.NodeEditor/.idea/workspace.xml +++ b/.idea/.idea.NodeEditor/.idea/workspace.xml @@ -28,12 +28,10 @@ - - - - + + + - @@ -54,6 +52,9 @@ @@ -106,8 +107,17 @@ @@ -152,8 +162,17 @@ + + + + + + \ No newline at end of file diff --git a/Controls/Path.xaml b/Controls/Path.xaml new file mode 100644 index 0000000..752362a --- /dev/null +++ b/Controls/Path.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/Controls/Path.xaml.cs b/Controls/Path.xaml.cs new file mode 100644 index 0000000..c695536 --- /dev/null +++ b/Controls/Path.xaml.cs @@ -0,0 +1,87 @@ +using System.Collections.Generic; +using System.Windows.Controls; +using System.Windows.Media; +using NodeEditor.Extensions; + +namespace NodeEditor.Controls +{ + public partial class Path : UserControl + { + public static List Paths { get; } = new List(); + public int[] Difficulty { get; set; } + public double Distance { get; set; } + public int LvlRequired { get; set; } + public Modes Mode { get; set; } + public int Cost { get; set; } + + public Path() + { + Difficulty = new[] {1, 1, 1, 1, 1}; + Distance = 0; + LvlRequired = 0; + Mode = Modes.Walk; + Cost = 0; + Paths.Add(this); + InitializeComponent(); + } + public Path(int distance) + { + Difficulty = new[] {1, 1, 1, 1, 1}; + Distance = distance; + LvlRequired = 0; + Mode = Modes.Walk; + Cost = 0; + Paths.Add(this); + InitializeComponent(); + } + public Path(int distance, Modes mode) + { + Difficulty = new[] {1, 1, 1, 1, 1}; + Distance = distance; + LvlRequired = 0; + Mode = mode; + Cost = 0; + Paths.Add(this); + InitializeComponent(); + } + public Path(int distance, Modes mode, int cost) + { + Difficulty = new[] {1, 1, 1, 1, 1}; + Distance = distance; + LvlRequired = 0; + Mode = mode; + Cost = cost; + Paths.Add(this); + InitializeComponent(); + } + public Path(int distance, Modes mode, int cost, int lvlRequired) + { + Difficulty = new[] {1, 1, 1, 1, 1}; + Distance = distance; + LvlRequired = lvlRequired; + Mode = mode; + Cost = cost; + Paths.Add(this); + InitializeComponent(); + } + public Path(int distance, Modes mode, int cost, int lvlRequired, int[] difficulty) + { + Difficulty = difficulty; + Distance = distance; + LvlRequired = lvlRequired; + Mode = mode; + Cost = cost; + Paths.Add(this); + InitializeComponent(); + } + + public void Destroy() + { + var parentObject = VisualTreeHelper.GetParent(this); + var parent = parentObject as Canvas; + + parent?.Children.Remove(this); + Paths.Remove(this); + } + } +} \ No newline at end of file diff --git a/Extensions/Modes.cs b/Extensions/Modes.cs new file mode 100644 index 0000000..cfa34fc --- /dev/null +++ b/Extensions/Modes.cs @@ -0,0 +1,12 @@ +namespace NodeEditor.Extensions +{ + public enum Modes + { + Seaskipper, + MageIsland, + Skyship, + Tunnel, + Elevator, + Walk + } +} \ No newline at end of file diff --git a/NodeEditor.csproj b/NodeEditor.csproj index b17e1d8..598be96 100644 --- a/NodeEditor.csproj +++ b/NodeEditor.csproj @@ -68,7 +68,11 @@ Node.xaml + + Path.xaml + + @@ -79,6 +83,7 @@ Designer MSBuild:Compile + MSBuild:Compile Designer From 0cab8fdb72b8a041118aba2286178073f4c6c28d Mon Sep 17 00:00:00 2001 From: liam Date: Mon, 21 Dec 2020 13:06:35 -0800 Subject: [PATCH 03/10] Updated Paths with a direction enum, and added seaskipper costs enum --- .idea/.idea.NodeEditor/.idea/contentModel.xml | 3 + .idea/.idea.NodeEditor/.idea/workspace.xml | 36 +++++++--- Controls/Path.xaml.cs | 19 +++++ Extensions/Direction.cs | 9 +++ Extensions/SeaskipperCosts.cs | 71 +++++++++++++++++++ NodeEditor.csproj | 4 ++ 6 files changed, 133 insertions(+), 9 deletions(-) create mode 100644 Extensions/Direction.cs create mode 100644 Extensions/SeaskipperCosts.cs diff --git a/.idea/.idea.NodeEditor/.idea/contentModel.xml b/.idea/.idea.NodeEditor/.idea/contentModel.xml index 38e1177..8234ce7 100644 --- a/.idea/.idea.NodeEditor/.idea/contentModel.xml +++ b/.idea/.idea.NodeEditor/.idea/contentModel.xml @@ -18,10 +18,12 @@ + + @@ -34,6 +36,7 @@ + diff --git a/.idea/.idea.NodeEditor/.idea/workspace.xml b/.idea/.idea.NodeEditor/.idea/workspace.xml index e2dffc2..a125e12 100644 --- a/.idea/.idea.NodeEditor/.idea/workspace.xml +++ b/.idea/.idea.NodeEditor/.idea/workspace.xml @@ -28,9 +28,9 @@ - - - + + + @@ -55,11 +55,15 @@ - + + + @@ -108,7 +114,7 @@ 1608418540783 - + 1608580007149 @@ -117,7 +123,14 @@ - @@ -167,12 +180,17 @@ - + + + + + - + \ No newline at end of file diff --git a/Controls/Path.xaml.cs b/Controls/Path.xaml.cs index c695536..5639972 100644 --- a/Controls/Path.xaml.cs +++ b/Controls/Path.xaml.cs @@ -14,6 +14,8 @@ namespace NodeEditor.Controls public Modes Mode { get; set; } public int Cost { get; set; } + public Direction Direction { get; set; } + public Path() { Difficulty = new[] {1, 1, 1, 1, 1}; @@ -21,6 +23,7 @@ namespace NodeEditor.Controls LvlRequired = 0; Mode = Modes.Walk; Cost = 0; + Direction = Direction.Both; Paths.Add(this); InitializeComponent(); } @@ -31,6 +34,7 @@ namespace NodeEditor.Controls LvlRequired = 0; Mode = Modes.Walk; Cost = 0; + Direction = Direction.Both; Paths.Add(this); InitializeComponent(); } @@ -41,6 +45,7 @@ namespace NodeEditor.Controls LvlRequired = 0; Mode = mode; Cost = 0; + Direction = Direction.Both; Paths.Add(this); InitializeComponent(); } @@ -51,6 +56,7 @@ namespace NodeEditor.Controls LvlRequired = 0; Mode = mode; Cost = cost; + Direction = Direction.Both; Paths.Add(this); InitializeComponent(); } @@ -61,6 +67,7 @@ namespace NodeEditor.Controls LvlRequired = lvlRequired; Mode = mode; Cost = cost; + Direction = Direction.Both; Paths.Add(this); InitializeComponent(); } @@ -71,6 +78,18 @@ namespace NodeEditor.Controls LvlRequired = lvlRequired; Mode = mode; Cost = cost; + Direction = Direction.Both; + Paths.Add(this); + InitializeComponent(); + } + public Path(int distance, Modes mode, int cost, int lvlRequired, int[] difficulty, Direction direction) + { + Difficulty = difficulty; + Distance = distance; + LvlRequired = lvlRequired; + Mode = mode; + Cost = cost; + Direction = direction; Paths.Add(this); InitializeComponent(); } diff --git a/Extensions/Direction.cs b/Extensions/Direction.cs new file mode 100644 index 0000000..06d05a5 --- /dev/null +++ b/Extensions/Direction.cs @@ -0,0 +1,9 @@ +namespace NodeEditor.Extensions +{ + public enum Direction + { + Both, + TowardsA, + TowardsB + } +} \ No newline at end of file diff --git a/Extensions/SeaskipperCosts.cs b/Extensions/SeaskipperCosts.cs new file mode 100644 index 0000000..6faf7c8 --- /dev/null +++ b/Extensions/SeaskipperCosts.cs @@ -0,0 +1,71 @@ +namespace NodeEditor.Extensions +{ + public enum SeaskipperCosts + { + NemractSelchar = 12, + NemractLlevigar = 42, + NemractRoosterIsland = 4, + NemractHalfMoonIsland = 8, + NemractMageIsland = 8, + NemractNodgujIsland = 14, + NemractZhightIsland = 16, + NemractDurumIsles = 4, + NemractBearZoo = 4, + SelcharLlevigar = 24, + SelcharNodgujIsland = 8, + SelcharSkiensIsland = 10, + SelcharVolcanicIsles = 18, + SelcharMaroPeaks = 12, + SelcharPirateCove = 16, + SelcharDeadIsland = 16, + SelcharGallionsGraveyard = 16, + LlevigarVolcanicIsles = 16, + LlevigarMaroPeaks = 18, + LlevigarPirateCove = 20, + LlevigarDeadIsland = 24, + LlevigarJofashDocks = 32, + LlevigarGallionsGraveyard = 16, + RoosterIslandNemract = 8, + RoosterIslandSelchar = 10, + RoosterIslandLlevigar = 38, + HalfMoonIslandNemract = 10, + HalfMoonIslandSelchar = 14, + HalfMoonIslandLlevigar = 40, + MageIslandNemract = 10, + MageIslandSelchar = 10, + MageIslandLlevigar = 40, + NodgujIslandNemract = 22, + NodgujIslandSelchar = 12, + NodgujIslandLlevigar = 32, + ZhightIslandNemract = 16, + ZhightIslandSelchar = 12, + ZhightIslandLlevigar = 30, + SkiensIslandNemract = 26, + SkiensIslandSelchar = 12, + SkiensIslandLlevigar = 30, + VolcanicIslesNemract = 34, + VolcanicIslesSelchar = 26, + VolcanicIslesLlevigar = 26, + MaroPeaksNemract = 28, + MaroPeaksSelchar = 20, + MaroPeaksLlevigar = 28, + PirateCoveNemract = 28, + PirateCoveSelchar = 14, + PirateCoveLlevigar = 28, + DeadIslandNemract = 32, + DeadIslandSelchar = 22, + DeadIslandLlevigar = 32, + JofashDocksNemract = 38, + JofashDocksSelchar = 26, + JofashDocksLlevigar = 38, + GallionsGraveyardNemract = 24, + GallionsGraveyardSelchar = 14, + GallionsGraveyardLlevigar = 28, + DurumIslesNemract = 8, + DurumIslesSelchar = 10, + DurumIslesLlevigar = 38, + BearZooNemract = 8, + BearZooSelchar = 10, + BearZooLlevigar = 38 + } +} \ No newline at end of file diff --git a/NodeEditor.csproj b/NodeEditor.csproj index 598be96..6ae815c 100644 --- a/NodeEditor.csproj +++ b/NodeEditor.csproj @@ -53,6 +53,7 @@ 4.0 + @@ -71,6 +72,7 @@ Path.xaml + @@ -92,6 +94,7 @@ App.xaml Code + MainWindow.xaml Code @@ -127,6 +130,7 @@ + 0.9.2 From 9b644359061151911bcbd97bcd0b937fe9c461cd Mon Sep 17 00:00:00 2001 From: liam Date: Mon, 21 Dec 2020 13:25:37 -0800 Subject: [PATCH 04/10] Hopefully fixed runtime identifiers stopping the program from running. --- .idea/.idea.NodeEditor/.idea/workspace.xml | 32 ++++++++++++++++------ Controls/Node.xaml.cs | 2 -- NodeEditor.csproj | 1 + 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.idea/.idea.NodeEditor/.idea/workspace.xml b/.idea/.idea.NodeEditor/.idea/workspace.xml index a125e12..fe11907 100644 --- a/.idea/.idea.NodeEditor/.idea/workspace.xml +++ b/.idea/.idea.NodeEditor/.idea/workspace.xml @@ -28,11 +28,9 @@ - - - - + + + + + @@ -114,7 +116,7 @@ 1608418540783 - + 1608580007149 @@ -130,7 +132,14 @@ - @@ -181,13 +190,18 @@ + + + + diff --git a/Controls/Node.xaml.cs b/Controls/Node.xaml.cs index 4ce0e7a..5504e31 100644 --- a/Controls/Node.xaml.cs +++ b/Controls/Node.xaml.cs @@ -10,8 +10,6 @@ namespace NodeEditor.Controls public partial class Node : UserControl { public static List Nodes { get; } = new List(); - - // ReSharper disable once UnusedAutoPropertyAccessor.Global public string Desc { get; set; } public Node() diff --git a/NodeEditor.csproj b/NodeEditor.csproj index 6ae815c..be91828 100644 --- a/NodeEditor.csproj +++ b/NodeEditor.csproj @@ -9,6 +9,7 @@ NodeEditor NodeEditor v4.7.2 + win 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 From a9918c479a58266864b853c4b5604f495f63c555 Mon Sep 17 00:00:00 2001 From: liam Date: Mon, 21 Dec 2020 13:54:43 -0800 Subject: [PATCH 05/10] screwed around with optimizations and styles --- .idea/.idea.NodeEditor/.idea/workspace.xml | 49 ++++++++++++++++++---- Controls/EditorCanvas.xaml | 18 ++++---- Controls/EditorCanvas.xaml.cs | 38 ++++++----------- Controls/Node.xaml | 38 +++++++++++++---- Controls/Node.xaml.cs | 2 +- MainWindow.xaml | 5 ++- 6 files changed, 97 insertions(+), 53 deletions(-) diff --git a/.idea/.idea.NodeEditor/.idea/workspace.xml b/.idea/.idea.NodeEditor/.idea/workspace.xml index fe11907..6a10738 100644 --- a/.idea/.idea.NodeEditor/.idea/workspace.xml +++ b/.idea/.idea.NodeEditor/.idea/workspace.xml @@ -30,8 +30,11 @@ + + + - + - + @@ -117,6 +123,7 @@ + 1608580007149 @@ -139,7 +146,14 @@ - @@ -191,20 +205,37 @@ - - + + + + + + + + + + + + + + + + + - + - + - + \ No newline at end of file diff --git a/Controls/EditorCanvas.xaml b/Controls/EditorCanvas.xaml index 2318208..8e0da6a 100644 --- a/Controls/EditorCanvas.xaml +++ b/Controls/EditorCanvas.xaml @@ -1,18 +1,20 @@ - - + - + + - + - + \ No newline at end of file diff --git a/Controls/EditorCanvas.xaml.cs b/Controls/EditorCanvas.xaml.cs index 9f465c8..4156416 100644 --- a/Controls/EditorCanvas.xaml.cs +++ b/Controls/EditorCanvas.xaml.cs @@ -1,29 +1,16 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Web.WebSockets; -using System.Windows; +using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using MahApps.Metro.Controls; -using NodeEditor.Extensions; -namespace NodeEditor +namespace NodeEditor.Controls { /// /// Interaction logic for EditorCanvas.xaml /// public partial class EditorCanvas : UserControl { - Point? dragStart = null; + private Point? _dragStart = null; public EditorCanvas() { @@ -38,26 +25,25 @@ namespace NodeEditor { var element = (UIElement) sender; // dragStart = new Point(e.GetPosition(mapCanvas).X * st.ScaleX, e.GetPosition(mapCanvas).Y * st.ScaleY); - var transform = mapCanvas.RenderTransform as MatrixTransform; - dragStart = new Point(e.GetPosition(mapCanvas).X * transform.Value.M11, e.GetPosition(mapCanvas).Y * transform.Value.M22); + if (mapCanvas.RenderTransform is MatrixTransform transform) + _dragStart = new Point(e.GetPosition(mapCanvas).X * transform.Value.M11, + e.GetPosition(mapCanvas).Y * transform.Value.M22); element.CaptureMouse(); } private void MapCanvas_StopDrag(object sender, MouseEventArgs e) { var element = (UIElement)sender; - dragStart = null; + _dragStart = null; element.ReleaseMouseCapture(); } private void MapCanvas_Drag(object sender, MouseEventArgs e) { - if (dragStart != null && e.LeftButton == MouseButtonState.Pressed) - { - var newPoint = e.GetPosition(m_EditorCanvas); + if (_dragStart == null || e.LeftButton != MouseButtonState.Pressed) return; + var newPoint = e.GetPosition(m_EditorCanvas); - Canvas.SetLeft(mapCanvas, newPoint.X - dragStart.Value.X); - Canvas.SetTop(mapCanvas, newPoint.Y - dragStart.Value.Y); - } + Canvas.SetLeft(mapCanvas, newPoint.X - _dragStart.Value.X); + Canvas.SetTop(mapCanvas, newPoint.Y - _dragStart.Value.Y); } private void MapCanvas_OnScroll(object sender, MouseWheelEventArgs e) @@ -74,7 +60,7 @@ namespace NodeEditor // } var element = sender as UIElement; var position = e.GetPosition(element); - var transform = mapCanvas.RenderTransform as MatrixTransform; + if (!(mapCanvas.RenderTransform is MatrixTransform transform)) return; var matrix = transform.Matrix; var scale = e.Delta >= 0 ? 1.1 : (1.0 / 1.1); // choose appropriate scaling factor diff --git a/Controls/Node.xaml b/Controls/Node.xaml index 1358e17..5bd1371 100644 --- a/Controls/Node.xaml +++ b/Controls/Node.xaml @@ -1,12 +1,36 @@  - - - - + + + + \ No newline at end of file diff --git a/Controls/Node.xaml.cs b/Controls/Node.xaml.cs index 5504e31..0195561 100644 --- a/Controls/Node.xaml.cs +++ b/Controls/Node.xaml.cs @@ -15,7 +15,7 @@ namespace NodeEditor.Controls public Node() { Nodes.Add(this); - Name = GetIndexOf(this).ToString(); + //Name = GetIndexOf(this).ToString(); Desc = ""; InitializeComponent(); } diff --git a/MainWindow.xaml b/MainWindow.xaml index b4d809f..2fe60da 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:NodeEditor" + xmlns:controls="clr-namespace:NodeEditor.Controls" mc:Ignorable="d" WindowStyle="ToolWindow" WindowStartupLocation="CenterScreen" @@ -64,8 +65,8 @@ - + - + From bb392ba72dcc81f620c76b3b0d302d4192d1718f Mon Sep 17 00:00:00 2001 From: liam Date: Mon, 21 Dec 2020 17:18:05 -0800 Subject: [PATCH 06/10] final commit before merge --- .idea/.idea.NodeEditor/.idea/workspace.xml | 24 ++++++++++------------ Controls/Node.xaml | 8 ++++---- Controls/Node.xaml.cs | 1 - 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/.idea/.idea.NodeEditor/.idea/workspace.xml b/.idea/.idea.NodeEditor/.idea/workspace.xml index 6a10738..0866b46 100644 --- a/.idea/.idea.NodeEditor/.idea/workspace.xml +++ b/.idea/.idea.NodeEditor/.idea/workspace.xml @@ -30,11 +30,8 @@ - - - - + + @@ -209,22 +207,22 @@ - + - - + + - - + + - - + + - + diff --git a/Controls/Node.xaml b/Controls/Node.xaml index 5bd1371..b52e9d9 100644 --- a/Controls/Node.xaml +++ b/Controls/Node.xaml @@ -7,7 +7,7 @@ mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> -