Class Annotations.SelectionModel
Represents a class that contains information about how an annotation should behave when selected.
Constructor Attributes | Constructor Name and Description |
---|---|
Annotations.SelectionModel(annotation, canModify, isSelected)
Create a new selection model.
|
Method Attributes | Method Name and Description |
---|---|
Indicates that the associated annotation is able to be modified
|
|
drawPopupTail(ctx, annotation, zoom, pinRect, targetPoint)
Draws the popup tail of an annotation's note.
|
|
drawSelectionOutline(ctx, annotation, zoom)
Draws the selection outline of the annotation.
|
|
Returns the ControlHandle objects associated with this selection model.
|
|
getDimensions(annotation)
Gets the dimensions {x, y, width, height} of the selection bounding box.
|
|
Indicates that the associated annotation is already selected.
|
|
testControlHandles(annotation, zoom, x, y)
Hit detection for each control handle
|
|
testSelection(annotation, x, y)
Determines if the provided point is a hit on the selected annotationhandle.
|
Class Detail
Annotations.SelectionModel(annotation, canModify, isSelected)
Create a new selection model.
- Parameters:
- {Annotations.Annotation} annotation
- the annotation selected
- {Boolean} canModify
- modification of the annotation is allowed
- {Boolean} isSelected
- the annotation is already selected
Method Detail
{Boolean}
canModify()
Indicates that the associated annotation is able to be modified
- Returns:
- {Boolean}
drawPopupTail(ctx, annotation, zoom, pinRect, targetPoint)
Draws the popup tail of an annotation's note.
- Parameters:
- {CanvasRenderingContext2D} ctx
- The canvas context
- {Annotations.Annotation} annotation
- The annotation
- {number} zoom
- The current zoom level
- {Annotations.Rect} pinRect
- The annotation's bounding rectangle
- {Annotations.Point} targetPoint
- The location of the note
drawSelectionOutline(ctx, annotation, zoom)
Draws the selection outline of the annotation.
By default, a rectangle is drawn based on the annotations x, y, width and height.
- Parameters:
- {CanvasRenderingContext2D} ctx
- {Annotations.Annotation} annotation
- {number} zoom
{Annotations.ControlHandle[]}
getControlHandles()
Returns the ControlHandle objects associated with this selection model.
- Returns:
- {Annotations.ControlHandle[]} an array of ControlHandleObject
{Annotations.Rect}
getDimensions(annotation)
Gets the dimensions {x, y, width, height} of the selection bounding box.
It may be different from the annotation's bounding box.
e.g. The selection bounding box may have a padding.
- Parameters:
- {Annotations.Annotation} annotation
- Returns:
- {Annotations.Rect}
{Boolean}
isSelected()
Indicates that the associated annotation is already selected.
This can be useful to implement different selection behaviors when an annotation is selected.
- Returns:
- {Boolean}
{Annotations.ControlHandle}
testControlHandles(annotation, zoom, x, y)
Hit detection for each control handle
- Parameters:
- {Annotations.Annotation} annotation
- {number} zoom
- {number} x
- {number} y
- Returns:
- {Annotations.ControlHandle} the control handle that was hit
{Boolean}
testSelection(annotation, x, y)
Determines if the provided point is a hit on the selected annotationhandle.
* See Annotations.SelectionAlgorithm for usuable selection algorithms.
- Parameters:
- {Annotations.Annotation} annotation
- the annotation
- {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