Exemplo n.º 1
0
        /// <summary>
        /// Handles the mouse up event.
        /// </summary>
        /// <param name="position">Mouse position.</param>
        /// <param name="e">MouseEventArgs as provided by the view.</param>
        /// <returns>The next mouse state handler that should handle mouse events.</returns>
        public override void OnMouseUp(PointD2D position, MouseButtonEventArgs e)
        {
            base.OnMouseUp(position, e);

            if (e.LeftButton == MouseButtonState.Released && null != _rectangleSelectionArea_GraphCoordinates)
            {
                _grac.FindGraphObjectInRootLayerRectangle(_rectangleSelectionArea_GraphCoordinates.Value, out var foundObjects);
                AddSelectedObjectsFromRectangularSelection(foundObjects);
                (_grac.ViewObject as IGraphView).ReleaseCaptureMouseOnCanvas();
                _rectangleSelectionArea_GraphCoordinates = null;
                _grac.RenderOverlay();
            }
            else if (ActiveGrip != null)
            {
                bool bRefresh = _wereObjectsMoved; // repaint the graph when objects were really moved
                bool bRepaint = false;
                _wereObjectsMoved = false;
                _grac.Doc.Resume(ref _graphDocumentChangedSuppressor);

                bool chooseNextLevel = ActiveGrip.Deactivate();
                ActiveGrip = null;

                if (chooseNextLevel && null != SingleSelectedHitTestObject)
                {
                    DisplayedGripLevel = SingleSelectedHitTestObject.GetNextGripLevel(DisplayedGripLevel);
                    bRepaint           = true;
                }

                _grac.RenderOverlay();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles the mouse up event.
        /// </summary>
        /// <param name="e">MouseEventArgs as provided by the view.</param>
        /// <returns>The next mouse state handler that should handle mouse events.</returns>
        public override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
        {
            base.OnMouseUp(e);

            if (ActiveGrip != null)
            {
                bool bRefresh = _wereObjectsMoved; // repaint the graph when objects were really moved
                bool bRepaint = false;
                _wereObjectsMoved = false;
                _grac.Doc.EndUpdate(ref _graphDocumentChangedSuppressor);

                bool chooseNextLevel = ActiveGrip.Deactivate();
                ActiveGrip = null;

                if (chooseNextLevel && null != SingleSelectedHitTestObject)
                {
                    DisplayedGripLevel = SingleSelectedHitTestObject.GetNextGripLevel(DisplayedGripLevel);
                    bRepaint           = true;
                }


                if (bRefresh)
                {
                    _grac.WinFormsController.RefreshGraph(); // redraw the contents
                }
                else if (bRepaint)
                {
                    _grac.WinFormsController.RepaintGraphArea();
                }
            }
        }