Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Sep 29, 2023
1 parent 166d2f3 commit d7fd99e
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/Geometry/Polygon.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ public function align(string $position): self
}

foreach ($this->points as $point) {
$point->setX($point->getX() - $diff);
$point->setX(
intval($point->getX() - $diff)
);
}

return $this;
Expand Down Expand Up @@ -331,7 +333,9 @@ public function valign(string $position): self
}

foreach ($this->points as $point) {
$point->setY($point->getY() - $diff);
$point->setY(
intval($point->getY() - $diff),
);
}

return $this;
Expand All @@ -350,16 +354,24 @@ public function rotate(float $angle): self

foreach ($this->points as $point) {
// translate point to pivot
$point->setX($point->getX() - $this->getPivot()->getX());
$point->setY($point->getY() - $this->getPivot()->getY());
$point->setX(
intval($point->getX() - $this->getPivot()->getX()),
);
$point->setY(
intval($point->getY() - $this->getPivot()->getY()),
);

// rotate point
$x = $point->getX() * $cos - $point->getY() * $sin;
$y = $point->getX() * $sin + $point->getY() * $cos;

// translate point back
$point->setX($x + $this->getPivot()->getX());
$point->setY($y + $this->getPivot()->getY());
$point->setX(
intval($x + $this->getPivot()->getX()),
);
$point->setY(
intval($y + $this->getPivot()->getY()),
);
}

return $this;
Expand Down

0 comments on commit d7fd99e

Please sign in to comment.