You are here

public function ImageWidgetCropManager::getAxisCoordinates in Image Widget Crop 8

Same name and namespace in other branches
  1. 8.2 src/ImageWidgetCropManager.php \Drupal\image_widget_crop\ImageWidgetCropManager::getAxisCoordinates()

Get center of crop selection.

Parameters

int[] $axis: Coordinates of x-axis & y-axis.

array $crop_selection: Coordinates of crop selection (width & height).

Return value

array<string,double> Coordinates (x-axis & y-axis) of crop selection zone.

1 call to ImageWidgetCropManager::getAxisCoordinates()
ImageWidgetCropManager::getCropOriginalDimension in src/ImageWidgetCropManager.php
Get the size and position of the crop.

File

src/ImageWidgetCropManager.php, line 202

Class

ImageWidgetCropManager
ImageWidgetCropManager calculation class.

Namespace

Drupal\image_widget_crop

Code

public function getAxisCoordinates(array $axis, array $crop_selection) {
  return [
    'x' => (int) round($axis['x'] + $crop_selection['width'] / 2),
    'y' => (int) round($axis['y'] + $crop_selection['height'] / 2),
  ];
}