示例#1
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            MapNode clickedNode = MapView.GetMapNodeFromPoint(e.Location);

            if (DragDropHandler.IsDragging)
            {
                DragDropHandler.OnMouseDrop(e);
            }
            else if (MapView.FormatPainter.Active)
            {
                MapView.FormatPainter.ExecuteMouseClick(clickedNode);
            }
            else
            {
                if (clickedNode == null) // IF 'event is not over node' AND 'canvas is not dragged'
                {
                    CanvasClick(e);
                }
                else
                {
                    var args = new NodeMouseEventArgs(clickedNode.NodeView, e);
                    if (e.Button == System.Windows.Forms.MouseButtons.Right)
                    {
                        NodeRightClick(clickedNode, args);
                        IgnoreNextMouseMove = true;
                    }
                    else
                    {
                        NodeClick(clickedNode, args);
                    }
                }
            }

            //base.OnMouseUp(e);
        }
示例#2
0
        private DropLocation CalculateDropLocation(Point p)
        {
            MapNode node = MapView.GetMapNodeFromPoint(p);

            if (node != null)
            {
                return(new DropLocation()
                {
                    Parent = node, InsertAfterSibling = true
                });
            }
            else
            {
                return(new DropLocation());
            }
        }
示例#3
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (IgnoreNextMouseMove)
            {
                IgnoreNextMouseMove = false;
                return;
            }

            if (e.Button != System.Windows.Forms.MouseButtons.None && !MapView.NodeTextEditor.IsTextEditing)
            {
                DragDropHandler.OnMouseDrag(e);
            }
            else
            {
                MapNode node = MapView.GetMapNodeFromPoint(e.Location);

                if (node != null)
                {
                    NodeMouseMove?.Invoke(node, new NodeMouseEventArgs(node.NodeView, e));
                    if (node != mouseOverNode)
                    {
                        if (mouseOverNode != null)
                        {
                            NodeMouseExit(mouseOverNode, e);
                        }
                        mouseOverNode = node;
                        NodeMouseEnter(node, e);
                    }
                }
                else if (mouseOverNode != null)
                {
                    NodeMouseExit(mouseOverNode, e);
                    mouseOverNode = null;
                }

                if (resetHoverEvent)
                {
                    const uint      HOVER_TIME      = 200; // miliseconds
                    TRACKMOUSEEVENT trackMouseEvent = new TRACKMOUSEEVENT(TMEFlags.TME_HOVER, this.Handle, HOVER_TIME);
                    TrackMouseEvent(ref trackMouseEvent);
                    resetHoverEvent = false;
                }
            }

            base.OnMouseMove(e);
        }
示例#4
0
        private void DragStart(MouseEventArgs e)
        {
            MapNode node = MapView.GetMapNodeFromPoint(e.Location);

            if (node == null)
            {
                this.dragObject       = MapView.Canvas;
                this.dragStartPoint   = e.Location;
                MapView.Canvas.Cursor = canvasDragCursor;
                //MapView.Canvas.Cursor = Cursors.SizeAll;
            }
            else
            {
                this.dragObject = node;
                NodeDragStart?.Invoke(node, new NodeMouseEventArgs(node.NodeView, e));
                MapView.Canvas.Cursor   = nodeDragCursor;
                MapView.Canvas.KeyDown += Canvas_KeyDown;
            }
        }
示例#5
0
        protected override void OnMouseHover(EventArgs e)
        {
            resetHoverEvent = true;
            if (DragDropHandler.IsDragging || MapView.FormatPainter.Active)
            {
                return;
            }

            Point clickPosition = this.PointToClient(Cursor.Position);

            mouseOverNode = MapView.GetMapNodeFromPoint(clickPosition);
            if (mouseOverNode != null)
            {
                NodeMouseEventArgs args = new NodeMouseEventArgs(mouseOverNode.NodeView,
                                                                 new MouseEventArgs(System.Windows.Forms.MouseButtons.None, 0, clickPosition.X, clickPosition.Y, 0));
                NodeMouseHover(mouseOverNode, args);
            }

            base.OnMouseHover(e);
        }