You are here

public function ImageWidgetCropManager::getAxisCoordinates in Image Widget Crop 8.2

Same name and namespace in other branches
  1. 8 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

arraystringinteger Coordinates (x-axis & y-axis) of crop selection zone.

Overrides ImageWidgetCropInterface::getAxisCoordinates

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

File

src/ImageWidgetCropManager.php, line 175

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),
  ];
}