You are here

public function Crop::anchor in Crop API 8.2

Same name and namespace in other branches
  1. 8 src/Entity/Crop.php \Drupal\crop\Entity\Crop::anchor()

Gets crop anchor (top-left corner of crop area).

Return value

array Array with two keys (x, y) and anchor coordinates as values.

Overrides CropInterface::anchor

File

src/Entity/Crop.php, line 90

Class

Crop
Defines the crop entity class.

Namespace

Drupal\crop\Entity

Code

public function anchor() {
  return [
    'x' => (int) ($this->x->value - $this->width->value / 2),
    'y' => (int) ($this->y->value - $this->height->value / 2),
  ];
}