private static void NodeControl_NodeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NodeControl me = d as NodeControl;

            me.NodeInfo = e.NewValue as NodeInfo;
        }
        private void Canvas_MouseMove(object sender, MouseEventArgs e)
        {
            Canvas canvas = sender as Canvas;

            if (movingNodeOrigins.Count > 0)
            {
                Point mousePosition = e.GetPosition(canvas);
                mousePosition = new Point(mousePosition.X - PanX, mousePosition.Y - PanY);

                foreach (NodeControl nodeControl in movingNodeOrigins.Keys)
                {
                    ContentPresenter contentPresenter    = VisualTreeHelper.GetParent(nodeControl) as ContentPresenter;
                    Point            nodeControlPosition = new Point(mousePosition.X / Scale - movingNodeOffsets[nodeControl].Value.X, mousePosition.Y / Scale - movingNodeOffsets[nodeControl].Value.Y);

                    nodeControlPosition.X = Math.Round(nodeControlPosition.X / 4) * 4;
                    nodeControlPosition.Y = Math.Round(nodeControlPosition.Y / 4) * 4;

                    contentPresenter.SetValue(Canvas.LeftProperty, nodeControlPosition.X);
                    contentPresenter.SetValue(Canvas.TopProperty, nodeControlPosition.Y);
                }
            }

            if (creatingNewLink)
            {
                DependencyObject overElement = e.OriginalSource as DependencyObject;
                while (overElement != null && !(overElement is NodeControl))
                {
                    overElement = VisualTreeHelper.GetParent(overElement);
                }

                NodeControl nodeControl = overElement as NodeControl;
                if (nodeControl != null)
                {
                    DestinationAnchorBinder.Anchor = nodeControl.NodeAnchor;
                }
                else
                {
                    Point mousePosition = e.GetPosition(canvas);

                    DestinationAnchorBinder.Anchor = DestinationAnchor;
                    DestinationAnchorBinder.Anchor.SetValue(Canvas.LeftProperty, mousePosition.X / Scale - PanX);
                    DestinationAnchorBinder.Anchor.SetValue(Canvas.TopProperty, mousePosition.Y / Scale - PanY);
                }

                NotifyPropertyChanged(nameof(DestinationAnchorBinder));
            }

            if (Panning)
            {
                Point panningPosition = e.GetPosition(EditorScroller);

                PanX += (panningPosition.X - panningStart.X) / Scale;
                PanY += (panningPosition.Y - panningStart.Y) / Scale;

                panningStart = panningPosition;
            }

            if (Selecting)
            {
                Point mousePosition = e.GetPosition(EditorCanvas);

                SelectionEnd = new Point(mousePosition.X + PanX, mousePosition.Y + PanY);
                SelectedNodes.Clear();

                Rect selectionRect = new Rect(SelectionStart, SelectionEnd);

                foreach (var pair in nodeControls)
                {
                    Rect nodeRect = new Rect(pair.Key.X + PanX, pair.Key.Y + PanY, pair.Value.ActualWidth, pair.Value.ActualHeight);

                    if (selectionRect.IntersectsWith(nodeRect))
                    {
                        SelectedNodes.Add(pair.Key);
                    }
                }

                UpdateThumbnail();
            }
        }