Skip to content

Function: gatherPickHits() ​

ts
function gatherPickHits(pixels, win, out, maxHits?): PickHitList;

Experimental

Collect the distinct pick ids in a read-back window. pixels holds win.size² RGBA8 pixels, rows bottom-up (as readPixels returns them). A pixel counts when it is not background, lies in the view's visible region, and its centre is within win.radius CSS px of the cursor (the pixel under the cursor always counts). Each id keeps its smallest distance; out ends sorted nearest first. maxHits stops after that many distinct ids in distance order (default: all).

Parameters ​

ParameterTypeDefault value
pixelsArrayLike<number>undefined
winReadonly<PickWindow>undefined
outPickHitListundefined
maxHitsnumberInfinity

Returns ​

PickHitList

Released under the MIT License.