public void Create(Shape shape, OOP1.Point pos) { pos.m_X -= ShapeSize / 2; pos.m_Y -= ShapeSize / 2; switch (shape) { case OOP1.Rectangle _: _shapes.Add(new OOP1.Rectangle(pos, new OOP1.Point(pos.m_X + ShapeSize, pos.m_Y + ShapeSize))); break; case Circle _: _shapes.Add(new Circle(pos, ShapeSize / 2)); break; case Triangle _: _shapes.Add(new Triangle( new OOP1.Point(pos.m_X + ShapeSize / 2, pos.m_Y), new OOP1.Point(pos.m_X, pos.m_Y + ShapeSize), new OOP1.Point(pos.m_X + ShapeSize, pos.m_Y + ShapeSize))); break; default: break; } }
public bool Move(OOP1.Point pos) { if (_draggedShape != null) { _draggedShape.Move(pos.m_X - ShapeSize / 2, pos.m_Y - ShapeSize / 2); return(true); } return(false); }
public void Delete(OOP1.Point pos) { _shapes.RemoveAll(s => s.IsHit(pos)); }
public void StartMove(OOP1.Point pos) => _draggedShape = _shapes.Find(s => s.IsHit(pos));