Class: RotationUtils

Core.Annotations. RotationUtils


new RotationUtils()

The namespace for utility functions for annotation rotation.

Methods


getRotatedBoundingBoxRectFromRectangularAnnotations(unrotatedDimensions, angle, rotationPoint)

Parameters:
Name Type Description
unrotatedDimensions Object An object with the annotation's unrotated dimensions (X, Y, Width and Height).
angle number The angle (radians) that the annotation in rotated.
rotationPoint Core.Math.Point The pivot point for which the annotation is rotated on.
Returns:
The rect representing the rotated annotation's bounding box.
Type
Core.Math.Rect

getRotatedPointsArray(pointsArray, angle, rotationPoint)

Parameters:
Name Type Description
pointsArray Array.<Core.Math.Point> An array containing the points to be rotated.
angle number The angle to rotate the points.
rotationPoint Core.Math.Point The pivot point around which the points in the array will be rotated.
Returns:
An array containing the rotated points.
Type
Array.<Core.Math.Point>

getRotationAngleInDegreesByRadians(angleInRadians)

Parameters:
Name Type Description
angleInRadians number The angle in radians.
Returns:
The angle in degrees.
Type
number

getRotationAngleInRadiansByDegrees(angleInDegrees)

Parameters:
Name Type Description
angleInDegrees number The angle in degrees.
Returns:
The angle in radians.
Type
number

getUnrotatedDimensionsFromRectangularAnnotations(rect, angle)

Parameters:
Name Type Description
rect Core.Math.Rect The rect representing the rotated annotation's bounding box.
angle number The angle that the annotation in rotated.
Returns:
An object with the annotation's unrotated dimensions (X, Y, Width and Height).
Type
Object

normalizeAngle(angleInRadians)

Parameters:
Name Type Description
angleInRadians number The angle in radians.
Returns:
The normalized angle (between 0 and 2*PI) in radians.
Type
number

PathCustomAnnotationRotationMixin()

Adds the following methods to a class:
  • rotate: Changes the Rotation property of the annotation, Updates the annotation path and updates the bounding box.
  • adjustRect: Adjusts the annotation's bounding box.
  • serialize / deserialize: Make sure the annotation gets correctly saved into the PDF when downloading the document and that it will load fine.
For this mixin to work properly, the annotation class must implement two methods:
  • setPath: Updates the annotation's path (Array of points)
  • getPath: returns the annotation's path (Array of points)

RectangularCustomAnnotationRotationMixin()

Adds the following methods to a class:
  • rotate: Changes the Rotation property of the annotation and updates the bounding box.
  • getUnrotatedDimensions: Calculates the correct dimension for drawing.
  • getRotatedAnnotationBoundingBoxRect: Calculates the bounding box dimensions.
  • serialize / deserialize: Make sure the annotation gets correctly saved into the PDF when downloading the document and that it will load fine.