useDesktopPointInput
Routes desktop pointer events by coordinates.
import { useDesktopPointInput } from 'filedom';
useDesktopPointInput({
enabled: playing,
onClick: ({ x, y }) => selectAt({ x, y }),
onRightClick: ({ x, y }) => flagAt({ x, y }),
onDrag: (event) => handleDrag(event),
});
Use this hook to route input by coordinates instead of by file. Each subscription is active only while enabled is true and its handler is set. Handlers can change on every render without resubscribing.
Options
PropType
enabled?boolean
Turns all subscriptions on or off. Default true.
Type
booleanonClick?((point: DesktopPoint) => void)
Receives { x, y, target? }.
Type
((point: DesktopPoint) => void)onRightClick?((point: DesktopPoint) => void)
Receives { x, y, target? }.
Type
((point: DesktopPoint) => void)onDrag?((event: DesktopDragEvent) => void)
Receives { phase: 'start' | 'move' | 'end', x, y }.
Type
((event: DesktopDragEvent) => void)Returns
Nothing (void).