Skip to content

Commit

Permalink
Add DrawableInterface::setPosition()
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Jun 9, 2024
1 parent 8ae307e commit 9ee98de
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
12 changes: 12 additions & 0 deletions src/Geometry/Bezier.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ public function position(): PointInterface
return $this->pivot;
}

/**
* {@inheritdoc}
*
* @see DrawableInterface::setPosition()
*/
public function setPosition(PointInterface $position): DrawableInterface
{
$this->pivot = $position;

return $this;
}

/**
* Implement iteration through all points of bezier
*
Expand Down
5 changes: 2 additions & 3 deletions src/Geometry/Ellipse.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ public function position(): PointInterface
}

/**
* Set position if ellipse
* {@inheritdoc}
*
* @param PointInterface $position
* @return Ellipse
* @see DrawableInterface::setPosition()
*/
public function setPosition(PointInterface $position): self
{
Expand Down
5 changes: 2 additions & 3 deletions src/Geometry/Polygon.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ public function position(): PointInterface
}

/**
* Set pivot position of polygon
* {@inheritdoc}
*
* @param PointInterface $position
* @return Polygon
* @see DrawableInterface::setPosition()
*/
public function setPosition(PointInterface $position): self
{
Expand Down
8 changes: 8 additions & 0 deletions src/Interfaces/DrawableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ interface DrawableInterface
*/
public function position(): PointInterface;

/**
* Set position of the drawable object
*
* @param PointInterface $position
* @return DrawableInterface
*/
public function setPosition(PointInterface $position): self;

/**
* Set the background color of the drawable object
*
Expand Down

0 comments on commit 9ee98de

Please sign in to comment.