Class 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.
Constructor Attributes | Constructor Name and Description |
---|---|
Annotations.ControlHandle(x, y, width, height)
Creates a new ControlHandle with the specified dimensions.
|
Method Attributes | Method Name and Description |
---|---|
draw(ctx, annotation, selectionBox, zoom)
Draws the control handle's appearance on the provided canvas context
|
|
getDimensions(selectionBox)
Gets the dimensions of the control handle
|
|
move(annotation, deltaX, deltaY, fromPoint, toPoint)
The method invoked when a control handle is moved.
|
|
testSelection(annotation, selectionBox, zoom, x, y)
Determines if the provided point is a hit on the control handle.
|
Class Detail
Annotations.ControlHandle(x, y, width, height)
Creates a new ControlHandle with the specified dimensions.
- Parameters:
- {number} x
- the x-coordinate of the upper-left point
- {number} y
- the y-coordinate of the upper-left point
- {number} width
- the width of the control handle
- {number} height
- the width of the control handle
Method Detail
draw(ctx, annotation, selectionBox, zoom)
Draws the control handle's appearance on the provided canvas context
- Parameters:
- {CanvasRenderingContext2D} ctx
- the annotation canvas context
- {Annotations.Annotation} annotation
- the annotation to modify
- {Annotations.Rect} selectionBox
- the selection rect
- {double} zoom
- the current zoom level of the document
getDimensions(selectionBox)
Gets the dimensions of the control handle
- Parameters:
- {Annotations.Rect} selectionBox
- the selection rect
{boolean}
move(annotation, deltaX, deltaY, fromPoint, toPoint)
The method invoked when a control handle is moved.
Override the method to provide custom behavior to control handles.
- Parameters:
- {Annotations.Annotation} annotation
- the annotation to modify
- {number} deltaX
- the change in x-coordinate
- {number} deltaY
- the change in y-coordinate
- {Annotations.Point} fromPoint
- the original page point (on mouse down)
- {Annotations.Point} toPoint
- the current page point
- Returns:
- {boolean} return true if a redraw operation is necessary
{Boolean}
testSelection(annotation, selectionBox, zoom, x, y)
Determines if the provided point is a hit on the control handle.
See Annotations.SelectionAlgorithm for usuable selection algorithms.
- Parameters:
- {Annotations.Annotation} annotation
- the annotation
- {Annotations.Rect} selectionBox
- the selection rect
- {number} zoom
- the current zoom level of the document
- {number} x
- the x-coordinate of the point to test, in page coordinates
- {number} y
- the y-coordinate of the point to test, in page coordinates
- Returns:
- {Boolean} true if the provided point is a hit