Exemple #1
0
        public bool IsDrag(MouseEventArgs e)
        {
            const int dragThreshold = 4; //Length in px to consider a drag (instead of a click)
            var       mouseOffset   = e.GetClientPos() - cursorStartPos;

            return(mouseOffset.GetLength() > dragThreshold);
        }
Exemple #2
0
        public void OnStartNodeDrag(INode nodeToDrag, MouseEventArgs e)
        {
            this.nodeToDrag = nodeToDrag;

            nodeToDragOutputs = nodeHandler.Tree.Nodes
                                .SelectMany(node => node.GetAllInputs()
                                            .OfType <InputProcedural>()
                                            .Where(input => input.ConnectedNode == nodeToDrag)).ToList();

            cursorStartPos = e.GetClientPos();
            nodeStartPos   = nodeToDrag.Pos;
        }
Exemple #3
0
 public void OnDrop(MouseEventArgs e)
 {
     //Console.WriteLine("Dropping node");
     if (nodeToDrag != null)
     {
         //TODO: Refactor this
         if (isDraggingNewNode)
         {
             isDraggingNewNode = false;
             nodeToDrag.Pos   += (e.GetClientPos() - cursorStartPos) / ZoomHandler.Zoom;
             nodeHandler.Tree.AddNode(nodeToDrag);
         }
         nodeToDrag = null;
     }
 }
 public void OnStartNodeDrag(NodeViewModel nodeToDrag, MouseEventArgs e, IVirtualStudioController virtualStudioController = null)
 {
     dragProcess = new NodeDragProcess(0, nodeToDrag, e.GetClientPos(), virtualStudioController);
 }