API > @blocksuite/blocks > getClosestBlockElementByPoint
Function: getClosestBlockElementByPoint ​
getClosestBlockElementByPoint(
point
,state
=null
,scale
=1
):Element
|null
Returns the closest block element by a point in the rect.
############### block
||############# block
||||########### block
|||| ...
|||| y - 2 * n
|||| ...
||||----------- cursor
|||| ...
|||| y + 2 * n
|||| ...
||||########### block
||############# block
############### block
############### block
||############# block
||||########### block
|||| ...
|||| y - 2 * n
|||| ...
||||----------- cursor
|||| ...
|||| y + 2 * n
|||| ...
||||########### block
||############# block
############### block
Parameters ​
Parameter | Type | Default value |
---|---|---|
point | Point | undefined |
state | null | {container : Element ; rect : Rect ; snapToEdge : {x : boolean ; y : boolean ;};} | null |
scale | number | 1 |
Returns ​
Element
| null
Defined In ​
packages/blocks/src/_common/utils/query.ts:447