コード例 #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();
            }
        }