new SelectionAlgorithm()
Represents static utility functions to determine hit testing for annotations.
Properties:
Name | Type | Default | Description |
---|---|---|---|
canvasVisibilityPadding |
number | 5 | Defines a padding for the canvas visibility test algorithm. Increase this value to make selection more forgiving. |
Methods
-
<static> boundingRectTest(annotation, x, y, zoom)
-
Tests if the provided x and y coordinate is within the annotation's bounding rectangle (x, y, width, height).
Parameters:
Name Type Default Description annotation
Core.Annotations.Annotation 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 zoom
number 1 the zoom level to use in the calculation if the annotation has a no zoom property Returns:
true if the provided point is a hit on the annotation- Type
- boolean
-
<static> canvasVisibilityTest(annotation, x, y)
-
Tests if the provided x and y coordinate is a visible point on the canvas.
Parameters:
Name Type Description annotation
Core.Annotations.Annotation 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 on the annotation- Type
- boolean
-
<static> insidePolygonTest(annotation, x, y, pageMatrix, zoom)
-
Tests if the provided x and y coordinate is inside of the provided polygon annotation
Parameters:
Name Type Description annotation
Core.Annotations.PolygonAnnotation The polygon annotation 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 pageMatrix
object The page matrix for the page that the annotation is on. zoom
number The zoom level to use in the calculation if the annotation has a no zoom property -
<static> textQuadTest(annotation, x, y)
-
Tests if the provided x and y coordinate is within a text Quad of the provided text-based annotation.
Parameters:
Name Type Description annotation
Core.Annotations.TextMarkupAnnotation the text markup annotation 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 on the annotation- Type
- boolean