new RotationControlWidget(center, setAngle) → {object}
Creates a rotation control widget.
Parameters:
Name | Type | Description |
---|---|---|
center |
paper.Point | The center point of the widget. |
setAngle |
function | The function to set the rotation angle. |
- Source:
Returns:
The rotation control widget object.
- Type
- object
Members
(static) widget
The rotation control widget object.
Properties:
Name | Type | Description |
---|---|---|
item |
paper.Group | The group containing all the elements of the widget. |
circle |
paper.Path.Circle | The central region with crosshair and cardinal points. |
cardinalControls |
Array.<paper.Path.Rectangle> | The controls for north, east, south, west. |
rotationLineControl |
paper.Group | The line with arrows indicating the spot for grabbing to perform rotation. |
- Source:
Example
// Usage example:
const rotationControl = new OSDPaperjsAnnotation.RotationControlWidget(centerPoint, setRotationAngle);
paper.project.activeLayer.addChild(rotationControl.item);
// Set the current rotation angle
rotationControl.setCurrentRotation(45);
// Set the line orientation for control
const orientationPoint = new paper.Point(150, 150);
rotationControl.setLineOrientation(orientationPoint, true);
Methods
setCurrentRotation(angle)
Sets the current rotation angle.
Parameters:
Name | Type | Description |
---|---|---|
angle |
number | The angle to set. |
- Source:
setLineOrientation(point, makeVisibleopt)
Sets the orientation of the line control.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
point |
paper.Point | The point representing the orientation. | ||
makeVisible |
boolean |
<optional> |
false | Whether to make the control visible. |
- Source: