Example #1
0
        public void ToolMouseDown(object Sender, MouseEventArgs Event)
        {
            XPoint = Event.X;
            YPoint = Event.Y;

            if (Event.Button == MouseButtons.Left)
            {
                this.SelectionArea = new Selection(Event.X, Event.Y);
                this.ActiveCanvas.AddDrawnShape(this.SelectionArea);
            }
            else if (Event.Button == MouseButtons.Right)
            {
                bool IntersectShape = false;
                if (SelectedShapes != null)
                {
                    foreach (Shape SelectedShape in SelectedShapes)
                    {
                        if (SelectedShape.Intersect(Event.X, Event.Y))
                        {
                            IntersectShape = true;
                            break;
                        }
                    }
                }

                if (!IntersectShape)
                {
                    SelectedShapes = new List <Shape>();
                    ActiveCanvas.DeselectAllShapes();
                    Shape SelectedShape = ActiveCanvas.GetShapeAt(Event.X, Event.Y);
                    if (SelectedShape != null)
                    {
                        SelectedShape.Select();
                        SelectedShapes.Add(SelectedShape);
                        IntersectShape = true;
                    }
                }

                if (IntersectShape)
                {
                    this.MovementTrace = new MovementLine(new System.Drawing.Point(Event.X, Event.Y))
                    {
                        Endpoint = new System.Drawing.Point(Event.X, Event.Y)
                    };
                    ActiveCanvas.AddDrawnShape(this.MovementTrace);
                }
            }
        }
 public void Select(MovementLine line, MovementMarker marker)
 {
     destinationLine   = line;
     destinationMarker = marker;
 }