@fabwcie/free-drawing / utils/hit
utils/hit
Functions
getLockedNode()
getLockedNode(
shape):DrawingShape
Defined in: packages/free-drawing/src/utils/hit.ts:88
Locked node of a locked shape: its top locked group, else itself (selected and unlocked as a whole)
Parameters
shape
locked drawing shape (or shape of a locked group)
Returns
top group not listening among its parent groups, else the shape
getShapes()
getShapes(
node):Shape<ShapeConfig>[]
Defined in: packages/free-drawing/src/utils/hit.ts:48
Shapes of a node: itself, or shapes of a group and its groups
Parameters
node
Node
shape, group or frame
Returns
Shape<ShapeConfig>[]
the shape itself, the shapes in a group at any depth, else none
isDrawnAt()
isDrawnAt(
node,point):boolean
Defined in: packages/free-drawing/src/utils/hit.ts:60
A visible shape of a node is drawn at a point (absolute position): fill, stroke, text box
Parameters
node
Node
shape or group
point
Vector2d
absolute position (pointer)
Returns
boolean
true when the hit region of one of its visible shapes is at the point (not for locked shapes)
isDrawnAtLocked()
isDrawnAtLocked(
node,point):boolean
Defined in: packages/free-drawing/src/utils/hit.ts:70
A visible shape of a node is drawn at a point, also when it is locked (konva draws hits of listening nodes only)
Parameters
node
Node
shape or group, locked or in a locked group
point
Vector2d
absolute position (pointer)
Returns
boolean
true when one of its visible shapes is drawn at the point
isInsideNode()
isInsideNode(
node,point):boolean
Defined in: packages/free-drawing/src/utils/hit.ts:104
Point is inside outline of a rectangle or an ellipse of a node (shape or group)
Parameters
node
Node
shape or group
point
Vector2d
absolute position (pointer)
Returns
boolean
true when inside one of its visible rectangles or ellipses, with or without background
isInsideOutline()
isInsideOutline(
shape,point):boolean
Defined in: packages/free-drawing/src/utils/hit.ts:266
Point (absolute position) is inside outline of a rectangle, an ellipse or a path shape, filled or not, whatever its transform
Parameters
shape
Shape<ShapeConfig>
rectangle, ellipse or path shape (other shapes checked by their box)
point
Vector2d
absolute position (pointer)
Returns
boolean
true when inside, edges included
isTouchedBy()
isTouchedBy(
box,node):boolean
Defined in: packages/free-drawing/src/utils/hit.ts:215
Drawing shape touched by a box (absolute coordinates, e.g. selection rectangle): lines and strokes along their points, other shapes along their box (rotated, scaled with them), shapes of groups too. A box entirely inside a shape does not touch it (box drawn in a big shape)
Parameters
box
IRect
touching box, in absolute coordinates
node
drawing shape or group (hidden shapes ignored)
Returns
boolean
true when one of its visible shapes is touched
rectContains()
rectContains(
outer,inner):boolean
Defined in: packages/free-drawing/src/utils/hit.ts:116
Inner box is entirely in outer box
Parameters
outer
IRect
containing box (selection rectangle...)
inner
IRect
contained box, same coordinates
Returns
boolean
true when inner is in outer, edges included
rectTouches()
rectTouches(
box,rect):boolean
Defined in: packages/free-drawing/src/utils/hit.ts:192
Box (absolute coordinates, e.g. a frame) touched by another box: crossed by it or in it, not when entirely around it
Parameters
box
IRect
touching box (selection rectangle)
rect
IRect
touched box (frame), same coordinates
Returns
boolean
true when a corner of rect is in box or a side of it crosses box
setupHit()
setupHit(
node):void
Defined in: packages/free-drawing/src/utils/hit.ts:32
Hit region of a drawing shape (shapes added, loaded...), shapes of a group: as drawn, strokes wider
Parameters
node
Node
drawing shape or group (its shapes set up too)
Returns
void