Exemple #1
0
        /// <summary>
        /// Begins dragging the clicked node and pushes it in front of other nodes.
        /// </summary>
        public void NodeMouseDown(NodeViewModel node, IMouseEventInfo e)
        {
            draggedNode     = node;
            dragMouseOffset = e.GetPosition(relativeTo: this) - draggedNode.Position;

            draggedNode.ZIndex = maxZValue++;
            draggedNode.NotifyOfPropertyChange(() => draggedNode.ZIndex);
        }
Exemple #2
0
        /// <summary>
        /// Updates the position of the dragged edge or node.
        /// </summary>
        public void MouseMove(IMouseEventInfo e)
        {
            if (e.LeftButton != MouseButtonState.Pressed)
            {
                draggedNode = null;
                DraggedEdge = null;
                // removes unnecessary inputs
                CullInputs();
                return;
            }

            if (draggedNode != null)
            {
                draggedNode.Position = e.GetPosition(relativeTo: this) - dragMouseOffset;
            }
            else if (DraggedEdge != null)
            {
                if (DraggedEdge.Status != EdgeStatus.Indeterminate)
                {
                    DraggedEdge.Status = EdgeStatus.Indeterminate;
                }
                DraggedEdge.EndPoint = e.GetPosition(relativeTo: this);
            }
        }