private void Canvas_MouseDown(object sender, MouseButtonEventArgs e) { _currentState |= State.LEFTMOUSE_DOWN; if (_currentState.HasFlag(State.DRAWING)) { _lastDownedPoint = GetDot(e.GetPosition(shapeCanvas).ToVector()); _movingPoint = GDot.FromCoord(e.GetPosition(shapeCanvas).ToVector()); if (_drawingShape == null) { if (_currentState.HasFlag(State.CIRCLE)) { _drawingShape = GCircle.FromTwoDots(_lastDownedPoint, _movingPoint); } else if (_currentState.HasFlag(State.LINE)) { _drawingShape = GLine.FromTwoDots(_lastDownedPoint, _movingPoint); } else if (_currentState.HasFlag(State.DOT)) { _drawingShape = _lastDownedPoint; } _drawingShape.Control.Stroke = Brushes.Blue; shapeCanvas.Children.Add(_drawingShape.Control); } } }