You are here

public function PositionedRectangle::translate in Image Effects 8

Same name and namespace in other branches
  1. 8.3 src/Component/PositionedRectangle.php \Drupal\image_effects\Component\PositionedRectangle::translate()
  2. 8.2 src/Component/PositionedRectangle.php \Drupal\image_effects\Component\PositionedRectangle::translate()

Translates the rectangle and any additional point.

Parameters

array $offset: Offset array (x, y).

Return value

$this

File

src/Component/PositionedRectangle.php, line 362

Class

PositionedRectangle
Rectangle algebra class.

Namespace

Drupal\image_effects\Component

Code

public function translate(array $offset) {
  if ($offset[0] || $offset[1]) {
    foreach ($this->points as &$point) {
      $this
        ->translatePoint($point, $offset);
    }
  }
  return $this;
}