follow function
Follows the pointer the way a light or a brush on an element wants it: a mouse or pen while it is over the element, the first finger while it is pressed on it.
import { follow } from '@dioramajs/diorama/kit'. Touch never blocks the page's scroll: the browser takes the finger with pointercancel when one starts. Each change asks for a frame. Listeners go with ctx.signal. Returns the live pointer; on adds callbacks.
function follow(
ctx: Pick<EffectContext, 'element' | 'signal' | 'invalidate'>,
on?: FollowHandlers,
): FollowedPointerParameters
| Name | Type | Description |
|---|---|---|
ctx | Pick<EffectContext, 'element' | 'signal' | 'invalidate'> | |
on? | FollowHandlers | Default |
Also exported from @dioramajs/effects/kit.
Defined in packages/effects/src/kit.ts.