@bigmistqke/pointer
v0.1.0
Published
Follow a pointer through a drag, framework-agnostic
Readme
@bigmistqke/pointer
Follow a pointer through a drag, framework-agnostic.
import { pointer } from '@bigmistqke/pointer'
element.addEventListener('pointerdown', async event => {
await pointer(event, ({ delta, totalDelta }) => {
// called on every pointermove, and once more on pointerup/pointercancel
})
})pointer captures the initiating element's pointer for the duration of the
drag, so moves keep arriving even while the pointer is outside the element,
and resolves when the drag ends.
