Skip to content
filedom
Esc
↑↓navigate↵open⌘Jpreview
On this page

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.

Typeboolean
onClick?((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).

Was this page helpful?