/// <summary> Pointer pressed. </summary> /// /// <param name="pointX"> The x coordinate. </param> /// <param name="pointY"> The y coordinate. </param> public void PressPointer(double pointX, double pointY) { if (pointX > 0 && pointY > 0) { _firstPointX = pointX; _firstPointY = pointY; if (_drawType == DrawType.Line) { _shape = ShapeFactory.GetLine(_firstPointX, _firstPointY, 0, 0); } else if (_drawType == DrawType.Diamond) { _shape = ShapeFactory.GetDiamond(_firstPointX, _firstPointY, 0, 0); } else if (_drawType == DrawType.Ellipse) { _shape = ShapeFactory.GetEllipse(_firstPointX, _firstPointY, 0, 0); } _isPressed = true; } }
/// <summary> Releases the shape. </summary> /// /// <exception cref="KeyNotFoundException"> Thrown when a Key Not Found error condition occurs. </exception> /// /// <param name="pointX"> The x coordinate. </param> /// <param name="pointY"> The y coordinate. </param> private void ReleaseShape(double pointX, double pointY) { IShape shape; if (_drawType == DrawType.Line) { shape = ShapeFactory.GetLine(_firstPointX, _firstPointY, pointX, pointY); } else if (_drawType == DrawType.Diamond) { shape = ShapeFactory.GetDiamond(_firstPointX, _firstPointY, pointX, pointY); } else if (_drawType == DrawType.Ellipse) { shape = ShapeFactory.GetEllipse(_firstPointX, _firstPointY, pointX, pointY); } else { return; } ICommand newCommand = new DrawCommand(this, shape); _commandManager.ExecuteNewCommand(newCommand); }