1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-11 08:24:02 +02:00

Rename method

- SizeInterface::getRelativePositionTo to
  SizeInterface::relativePositionTo
This commit is contained in:
Oliver Vogel
2023-10-26 17:24:04 +02:00
parent fbcfab2b6c
commit 4a301dcda0
5 changed files with 10 additions and 10 deletions

View File

@@ -51,6 +51,6 @@ class PlaceModifier implements ModifierInterface
$image_size = $image->size()->movePivot($this->position, $this->offset_x, $this->offset_y);
$watermark_size = $watermark->size()->movePivot($this->position);
return $image_size->getRelativePositionTo($watermark_size);
return $image_size->relativePositionTo($watermark_size);
}
}

View File

@@ -44,6 +44,6 @@ class PlaceModifier implements ModifierInterface
$image_size = $image->size()->movePivot($this->position, $this->offset_x, $this->offset_y);
$watermark_size = $watermark->size()->movePivot($this->position);
return $image_size->getRelativePositionTo($watermark_size);
return $image_size->relativePositionTo($watermark_size);
}
}

View File

@@ -167,7 +167,7 @@ class Rectangle extends Polygon implements SizeInterface, DrawableInterface
$reference->movePivot($position);
$this->movePivot($position)->setPivot(
$reference->getRelativePositionTo($this)
$reference->relativePositionTo($this)
);
return $this;
@@ -180,7 +180,7 @@ class Rectangle extends Polygon implements SizeInterface, DrawableInterface
* @param SizeInterface $rectangle
* @return PointInterface
*/
public function getRelativePositionTo(SizeInterface $rectangle): PointInterface
public function relativePositionTo(SizeInterface $rectangle): PointInterface
{
return new Point(
$this->pivot()->getX() - $rectangle->pivot()->getX(),

View File

@@ -16,7 +16,7 @@ interface SizeInterface
public function isPortrait(): bool;
public function movePivot(string $position, int $offset_x = 0, int $offset_y = 0): SizeInterface;
public function alignPivotTo(SizeInterface $size, string $position): SizeInterface;
public function getRelativePositionTo(SizeInterface $size): PointInterface;
public function relativePositionTo(SizeInterface $size): PointInterface;
public function resize(?int $width = null, ?int $height = null): SizeInterface;
public function resizeDown(?int $width = null, ?int $height = null): SizeInterface;
public function scale(?int $width = null, ?int $height = null): SizeInterface;

View File

@@ -209,7 +209,7 @@ class RectangleTest extends TestCase
$input = new Rectangle(200, 100);
$container->movePivot('top-left');
$input->movePivot('top-left');
$pos = $container->getRelativePositionTo($input);
$pos = $container->relativePositionTo($input);
$this->assertEquals(0, $pos->getX());
$this->assertEquals(0, $pos->getY());
@@ -217,7 +217,7 @@ class RectangleTest extends TestCase
$input = new Rectangle(200, 100);
$container->movePivot('center');
$input->movePivot('top-left');
$pos = $container->getRelativePositionTo($input);
$pos = $container->relativePositionTo($input);
$this->assertEquals(400, $pos->getX());
$this->assertEquals(300, $pos->getY());
@@ -225,7 +225,7 @@ class RectangleTest extends TestCase
$input = new Rectangle(200, 100);
$container->movePivot('bottom-right');
$input->movePivot('top-right');
$pos = $container->getRelativePositionTo($input);
$pos = $container->relativePositionTo($input);
$this->assertEquals(600, $pos->getX());
$this->assertEquals(600, $pos->getY());
@@ -233,7 +233,7 @@ class RectangleTest extends TestCase
$input = new Rectangle(200, 100);
$container->movePivot('center');
$input->movePivot('center');
$pos = $container->getRelativePositionTo($input);
$pos = $container->relativePositionTo($input);
$this->assertEquals(300, $pos->getX());
$this->assertEquals(250, $pos->getY());
@@ -241,7 +241,7 @@ class RectangleTest extends TestCase
$input = new Rectangle(100, 100);
$container->movePivot('center');
$input->movePivot('center');
$pos = $container->getRelativePositionTo($input);
$pos = $container->relativePositionTo($input);
$this->assertEquals(0, $pos->getX());
$this->assertEquals(50, $pos->getY());
}