internal bool HitTestConnection(Point testPoint, out CPinViewModel hitPin, out Point hitCanvasCoords)
        {
            hitCanvasCoords = NodeCanvas.PointFromScreen(testPoint);
            Point         hitTestPoint = NodeGraphOuter.PointFromScreen(testPoint);
            IInputElement hitElement   = NodeGraphOuter.InputHitTest(hitTestPoint);

            if (hitElement is FrameworkElement uiElement)
            {
                if (uiElement.DataContext is CPinViewModel hitPinVM)
                {
                    hitPin = hitPinVM;
                    return(true);
                }
            }

            hitPin = null;
            return(false);
        }
        internal Point GetPasteReferenceLocation()
        {
            System.Drawing.Point mouse = System.Windows.Forms.Cursor.Position;
            Point mousePoint           = new Point(mouse.X, mouse.Y);
            Point viewPoint            = PointFromScreen(mousePoint);

            Point viewMax     = new Point(ActualWidth, ActualHeight);
            Point canvasPoint = NodeCanvas.PointFromScreen(mousePoint);

            if (viewPoint.X > 0 && viewPoint.Y > 0 && viewPoint.X < viewMax.X && viewPoint.Y < viewMax.Y)
            {
                return(canvasPoint);
            }

            // little hack here as nodes are pasted at their TopLeft Corner we offset the MaxBottomRight location so nodes are not pasted entirely offscreen
            double viewX = Math.Max(Math.Min(viewMax.X - 100, viewPoint.X), 0);
            double viewY = Math.Max(Math.Min(viewMax.Y - 100, viewPoint.Y), 0);

            GeneralTransform toCanvas = NodeGraphOuter.TransformToDescendant(NodeCanvas);

            return(toCanvas.Transform(new Point(viewX, viewY)));
        }