/** * Returns the height of the offset attribute for a rotated element. * Using this height, we'll construct a div before and after the rotated element * @param IdmlElement $element * @return string */ public static function getOffsetHeight(IdmlElement $element) { $containingBoundary = new IdmlBoundary($element->boundary->top, $element->boundary->left, $element->boundary->bottom, $element->boundary->right); $containingBoundary->rotate($element->transformation->getB()); $elementHeight = $element->boundary->getHeight(); $containerHeight = $containingBoundary->getHeight(); $offsetHeight = ($containerHeight - $elementHeight) / 2; if ($offsetHeight < 0) { $offsetHeight = 0; } return $offsetHeight; }