Class: ControlHandle

Core.Annotations. ControlHandle

Represents a base class for control handles for selected annotations that can be moved. Control handles are typically used to resize an annotation or other operations that modify the annotation.

new ControlHandle(x, y, width, height)

Creates a new ControlHandle with the specified dimensions.
Parameters:
Name Type Description
x number The x-coordinate of the upper-left point
y number The y-coordinate of the upper-left point
width number The width of the control handle
height number The width of the control handle

Members


<static> color

Defines the color for the annotation control point.
Type:

<static> handleHeight

Defines the height of all control handles. Default is 10.
Type:
  • number

<static> handleWidth

Defines the width of all control handles. Default is 10.
Type:
  • number

<static> outlineColor

Defines the outline color for the annotation control point.
Type:

<static> rotationHandleHeight

Defines the height of all rotation control handles. Default is 28.
Type:
  • number

<static> rotationHandleWidth

Defines the width of all rotation control handles. Default is 28.
Type:
  • number

<static> selectionAccuracyPadding

Defines a padding for selection accuracy. Default is 1. Increase this value to make selection more forgiving.
Type:
  • number

<static> selectionPointOutlineThickness

Defines thickness of the annotation selection outline. Default is 3.
Type:
  • number

<static> shadowBlur

Defines the shadow blur for the annotation control point.
Type:
  • number

<static> shadowColor

Defines the shadow color for the annotation control point.
Type:

<static> shadowOffsetY

Defines the offset Y position for the shadow blur for the annotation control point.
Type:
  • number

Methods


draw(ctx, annotation, selectionBox, zoom)

Draws the control handle's appearance on the provided canvas context
Parameters:
Name Type Description
ctx CanvasRenderingContext2D the annotation canvas context
annotation Core.Annotations.Annotation the annotation to modify
selectionBox Core.Math.Rect the selection rect
zoom number the current zoom level of the document

testSelection(annotation, selectionBox, zoom, x, y)

Determines if the provided point is a hit on the control handle. See Core.Annotations.SelectionAlgorithm for usuable selection algorithms.
Parameters:
Name Type Description
annotation Core.Annotations.Annotation the annotation
selectionBox Core.Math.Rect the selection rect
zoom number the current zoom level of the document
x number the x-coordinate of the point to test, in page coordinates
y number the y-coordinate of the point to test, in page coordinates
Returns:
true if the provided point is a hit
Type
boolean