HitResult
A HitResult object contains information about the results of a hit test. It is returned by item.hitTest(point) and project.hitTest(point).
Properties
Describes the type of the hit result. For example, if you hit a segment point, the type would be 'segment'.
- 'segment', 'handle-in', 'handle-out', 'curve', 'stroke', 'fill', 'bounds', 'center', 'pixel'
Values:
- String
Type:
If the HitResult has a hitResult.type of 'bounds', this property describes which corner of the bounding rectangle was hit.
The names refer to the item’s own bounding rectangle, transformed by its item.matrix, which is the rectangle that the item’s selection draws. On mirrored or rotated items, a handle can therefore appear elsewhere on screen than its name says, while its opposite handle and the rectangle’s axes stay the ones to transform the item by. To choose a cursor, use the direction from the rectangle’s center to hitResult.point, both in project coordinates.
- 'top-left', 'top-right', 'bottom-left', 'bottom-right', 'left-center', 'top-center', 'right-center', 'bottom-center'
Values:
- String
Type:
If the HitResult has a type of ‘curve’ or ‘stroke’, this property gives more information about the exact position that was hit on the path.
- CurveLocation
Type:
If the HitResult has a type of ‘stroke’, ‘segment’, ‘handle-in’ or ‘handle-out’, this property refers to the segment that was hit or that is closest to the hitResult.location on the curve.
- Segment
Type:
Paper.js v0.14.0
Copyright © 2011—2026 Jürg Lehni & Jonathan Puckey. All Rights Reserved.