private void OnMouseClick3dAction(Mouse3dPosition point)
 {
     if (point.IsMouseDown)
     {
         // Check if a shape dragging is currently executing
         if (_selectedShape.IsDragging)
         {
             _selectedShape.MouseDrag(point.Point.X(), point.Point.Y());
             _selectedShape.Display(true);
         }
         else if (_selectedShape.CanDrag(point.Point.X(), point.Point.Y()))
         {
             // Launch the dragging operation
             _selectedShape.StartDragging(point.Point.X(), point.Point.Y());
         }
     }
     else
     {
         if (_selectedShape.IsDragging)
         {
             _selectedShape.EndDragging();
             Inputs[ActionNames.EditDetectionPipe].OnNotification(PipeConstants.RegenerateSolver);
         }
     }
 }
示例#2
0
        protected override void SourceOnData(object data)
        {
            // Check if the pipe is enabled
            if (!_enableEditDetectionPipe)
            {
                return;
            }

            var mouseData = data as Mouse3dPosition;

            // Filter the mouse events, only mouse down is passing
            if (!mouseData.IsMouseDown)
            {
                return;
            }

            // Filter also the shape dragging
            if (_selectedShape != null)
            {
                if (_selectedShape.CanDrag(mouseData.Point.X(), mouseData.Point.Y()))
                {
                    return;
                }
                if (_selectedShape.IsDragging)
                {
                    return;
                }
            }

            // Retrieve the selected shapes and enable the markers for them
            bool shapeSelected = false;

            _selectedShape = null;
            foreach (Shape2d shape2d in _drawnShapesList)
            {
                int nb = _context2d.NbSelected();
                if (_context2d.IsSelected(shape2d))
                {
                    shape2d.Select();
                    _selectedShape = shape2d;
                    _context2d.AddOrRemoveSelected(shape2d, false);

                    shapeSelected = true;
                }
                else
                {
                    shape2d.Deselect();
                }
                shape2d.EndDragging();
            }

            if (shapeSelected)
            {
                log.Debug("EditDetectionPipe shape selected");

                // Inform the action controller that it can switch to edit mode
                ActivateActionHandler(ActionType.Action2d_EditShape, true);

                // Notify listeners that a new selected shape is found
                AddData(_selectedShape);
            }
            else
            {
                //log.Debug("EditDetectionPipe unselect shape");
                //ActivateActionHandler(ActionType.Action2d_EditShape, false);
            }

            _view2d.Update();
        }