HitIndex
Defined in: core/hit-test.ts:83
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new HitIndex(
drawables,tolerance?,screenMode?,padFills?):HitIndex
Defined in: core/hit-test.ts:97
screenMode mirrors the layer’s “screen” sizeMode: geometry is rendered at constant pixel
size around a projected anchor rather than scaled by the view transform, so pick() must
account for the anchor per entry instead of inverting the transform globally.
padFills gives fills the stroke’s pick pad: a point within tolerance of a fill’s outline hits it too
(a thin filled link, #542, keeps the hover band it had as a stroke). Other layers’ fills hit inside only.
Parameters
Section titled “Parameters”drawables
Section titled “drawables”readonly DrawableVector[]
tolerance?
Section titled “tolerance?”number = 1
screenMode?
Section titled “screenMode?”boolean = false
padFills?
Section titled “padFills?”boolean = false
Returns
Section titled “Returns”HitIndex
Properties
Section titled “Properties”testedEntries
Section titled “testedEntries”testedEntries:
number=0
Defined in: core/hit-test.ts:90
Diagnostics: cumulative count of precise per-entry tests run by pick(). The #216 regression test asserts tests-per-pick stays ≪ N (the grid’s deterministic signature).
Methods
Section titled “Methods”append()
Section titled “append()”append(
drawables):void
Defined in: core/hit-test.ts:102
Add more drawables to the index (used by incremental layer append).
Parameters
Section titled “Parameters”drawables
Section titled “drawables”readonly DrawableVector[]
Returns
Section titled “Returns”void
pick()
Section titled “pick()”pick(
x,y,t):string|number|null
Defined in: core/hit-test.ts:268
Pick the topmost drawable under the pointer, given a SCREEN-space (CSS px) point and the
current view transform. World layers invert the transform once; screen layers (constant
pixel size) instead shift the query into each entry’s geometry frame about its projected
anchor, reproducing the render screen = project(anchor) + (vertex - anchor).
O(candidates in the pointer’s grid neighbourhood), not O(entries) — see Grid.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”string | number | null