Beispiel #1
0
        void OnDragStarted(DragStartedMessage obj)
        {
            DraggingGatos = obj.Gatos;

            // Hide the button, show the drop target
            DropTarget.TranslateTo(0, 30);
        }
Beispiel #2
0
        public void ExecuteDraggingCommand(MouseEventArgs _e)
        {
            if (IsDragging)
            {
                //
                // Raise the event to notify that dragging is in progress.
                //

                var curMousePoint = _e.GetPosition(ParentNetworkView.Visual);


                var offset = curMousePoint - LastMousePoint;
                if (offset.X != 0.0 || offset.Y != 0.0)
                {
                    LastMousePoint = curMousePoint;
                    Messenger.Default.Send(new DragMessage(this, offset.X, offset.Y));
                }
            }
            else if (isLeftMouseDown && ParentNetworkView.EnableNodeDragging)
            {
                //
                // The user is left-dragging the node,
                // but don't initiate the drag operation until
                // the mouse cursor has moved more than the threshold distance.
                //
                var curMousePoint = _e.GetPosition(ParentNetworkView.Visual);
                var dragDelta     = curMousePoint - lastMousePoint;
                var dragDistance  = Math.Abs(dragDelta.Length);
                if (dragDistance > dragThreshold)
                {
                    //
                    // When the mouse has been dragged more than the threshold value commence dragging the node.
                    //

                    //
                    // Raise an event to notify that that dragging has commenced.
                    //
                    var msg = new DragStartedMessage(this);
                    Messenger.Default.Send(msg);

                    if (msg.Cancel)
                    {
                        //
                        // Handler of the event disallowed dragging of the node.
                        //
                        IsLeftMouseDown           = false;
                        IsLeftMouseAndControlDown = false;
                        return;
                    }

                    IsDragging = true;
                    Visual.CaptureMouse();
                    _e.Handled = true;
                }
            }
        }
Beispiel #3
0
 private void DragStarted(DragStartedMessage _action)
 {
     IsDragging           = true;
     Mouse.OverrideCursor = Cursors.Hand;
 }