Пример #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();
            }
        }
Пример #2
0
        /// <summary>
        /// Handles the mouse move 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 OnMouseMove(PointD2D position, MouseEventArgs e)
        {
            base.OnMouseMove(position, e);

            if (null != ActiveGrip)
            {
                PointD2D graphCoord = _grac.ConvertMouseToRootLayerCoordinates(position);
                ActiveGrip.MoveGrip(graphCoord);
                _wereObjectsMoved = true;
                _grac.RenderOverlay();
            }
            else if (e.LeftButton == MouseButtonState.Pressed)
            {
                var diffPos = position - _positionLastMouseDownInMouseCoordinates;

                var oldRect = _rectangleSelectionArea_GraphCoordinates;

                if (null != _rectangleSelectionArea_GraphCoordinates ||
                    Math.Abs(diffPos.X) >= System.Windows.SystemParameters.MinimumHorizontalDragDistance ||
                    Math.Abs(diffPos.Y) >= System.Windows.SystemParameters.MinimumHorizontalDragDistance)
                {
                    if (null == _rectangleSelectionArea_GraphCoordinates)
                    {
                        (_grac.ViewObject as IGraphView).CaptureMouseOnCanvas();
                    }

                    var pt1  = _grac.ConvertMouseToRootLayerCoordinates(_positionLastMouseDownInMouseCoordinates);
                    var rect = new RectangleD2D(pt1, PointD2D.Empty);
                    rect.ExpandToInclude(_grac.ConvertMouseToRootLayerCoordinates(position));
                    _rectangleSelectionArea_GraphCoordinates = rect;
                }
                if (null != _rectangleSelectionArea_GraphCoordinates)
                {
                    _grac.RenderOverlay();
                }
            }
        }
Пример #3
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)
			{
				List<IHitTestObject> foundObjects;
				_grac.FindGraphObjectInRootLayerRectangle(_rectangleSelectionArea_GraphCoordinates.Value, out foundObjects);
				AddSelectedObjectsFromRectangularSelection(foundObjects);
				_grac.ReleaseMouseCapture();
				_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();
			}
		}
Пример #4
0
		/// <summary>
		/// Handles the mouse move 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 OnMouseMove(PointD2D position, MouseEventArgs e)
		{
			base.OnMouseMove(position, e);

			if (null != ActiveGrip)
			{
				PointD2D graphCoord = _grac.ConvertMouseToRootLayerCoordinates(position);
				ActiveGrip.MoveGrip(graphCoord);
				_wereObjectsMoved = true;
				_grac.RenderOverlay();
			}
			else if (e.LeftButton == MouseButtonState.Pressed)
			{
				var diffPos = position - _positionLastMouseDownInMouseCoordinates;

				var oldRect = _rectangleSelectionArea_GraphCoordinates;

				if (null != _rectangleSelectionArea_GraphCoordinates ||
						Math.Abs(diffPos.X) >= System.Windows.SystemParameters.MinimumHorizontalDragDistance ||
						Math.Abs(diffPos.Y) >= System.Windows.SystemParameters.MinimumHorizontalDragDistance)
				{
					if (null == _rectangleSelectionArea_GraphCoordinates)
					{
						_grac.CaptureMouse();
					}

					var pt1 = _grac.ConvertMouseToRootLayerCoordinates(_positionLastMouseDownInMouseCoordinates);
					var rect = new RectangleD2D(pt1, PointD2D.Empty);
					rect.ExpandToInclude(_grac.ConvertMouseToRootLayerCoordinates(position));
					_rectangleSelectionArea_GraphCoordinates = rect;
				}
				if (null != _rectangleSelectionArea_GraphCoordinates)
					_grac.RenderOverlay();
			}
		}