new RotationUtils()
A namespace containing utility functions for annotation rotation
Methods
-
<static> getRotatedBoundingBoxRectFromRectangularAnnotations(unrotatedDimensions, angle, rotationPoint)
-
Calculates the rotated bounding box rect from an annotation's unrotated dimensions
Parameters:
Name Type Description unrotatedDimensionsCore.Annotations.RotationUtils.UnrotatedDimensions An object with the annotation's unrotated dimensions anglenumber The angle (in radians) that the annotation is rotated rotationPointCore.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
-
<static> getRotatedPointsArray(pointsArray, angle, rotationPoint)
-
Calculates and returns the rotated positions of an array of points
Parameters:
Name Type Description pointsArrayArray.<Core.Math.Point> An array containing the points to be rotated anglenumber The angle (in radians) to rotate the points rotationPointCore.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>
-
<static> getRotationAngleInDegreesByRadians(angleInRadians)
-
Converts an angle in radians to degrees
Parameters:
Name Type Description angleInRadiansnumber The angle in radians Returns:
The angle in degrees- Type
- number
-
<static> getRotationAngleInRadiansByDegrees(angleInDegrees)
-
Converts an angle in degrees to radians
Parameters:
Name Type Description angleInDegreesnumber The angle in degrees Returns:
The angle in radians- Type
- number
-
<static> getUnrotatedDimensionsFromRectangularAnnotations(rect, angle)
-
Calculates the unrotated dimensions from a rotated rectangular annotation's bounding box
Parameters:
Name Type Description rectCore.Math.Rect The rect representing the rotated annotation's bounding box anglenumber The angle (in radians) that the annotation is rotated Returns:
An object with the annotation's unrotated dimensions -
<static> normalizeAngle(angleInRadians)
-
Normalizes an angle to be within the range of 0 to 2π radians
Parameters:
Name Type Description angleInRadiansnumber The angle in radians Returns:
The normalized angle (between 0 and 2π) in radians- Type
- number
-
PathCustomAnnotationRotationMixin()
-
A mixin that adds rotation support for path-based custom annotations. 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: Makes sure the annotation gets correctly saved into the PDF when downloading the document and that it will load correctly
- setPath: Updates the annotation's path (array of points)
- getPath: Returns the annotation's path (array of points)
Returns:
A mixin object to be applied to a custom annotation class- Type
- object
-
RectangularCustomAnnotationRotationMixin()
-
A mixin that adds rotation support for rectangular custom annotations. 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: Makes sure the annotation gets correctly saved into the PDF when downloading the document and that it will load correctly
Returns:
A mixin object to be applied to a custom annotation class- Type
- object
Type Definitions
-
UnrotatedDimensions
-
Type:
- object
Properties:
Name Type Description xnumber The x-coordinate of the top-left corner ynumber The y-coordinate of the top-left corner widthnumber The width of the unrotated annotation heightnumber The height of the unrotated annotation