@pbroom/color-kit/driverDrag controller
PointerDragControllerConfig
Configuration for createPointerDragController.
import type { PointerDragControllerConfig } from '@pbroom/color-kit/driver';drag-controller.ts:46interface PointerDragControllerConfig<TInput> {
normalize: (input: TInput) => DragPoint | null;
commit: (point: DragPoint, info: DragCommitInfo) => void;
maxUpdateHz?: number;
dragEpsilon?: number;
getCurrentPoint?: () => DragPoint | null;
}Properties
- normalize
(input: TInput) => DragPoint | null - Maps raw input (for example client coordinates) to a normalized point. Return
null(or non-finite coordinates) to skip the input. - commit
(point: DragPoint, info: DragCommitInfo) => void - Applies a committed, normalized point.
- maxUpdateHz?
numberdefault60 - Maximum commits per second while dragging. Non-positive or non-finite values fall back to the default.
- dragEpsilon?
numberdefault0.0005 - Skip a move when neither axis changed by more than this normalized delta. Negative or non-finite values fall back to the default.
- getCurrentPoint?
() => DragPoint | null - The control's current normalized position. When provided,
dragEpsilonis measured against it rather than the last committed point, so a value changed elsewhere mid-drag (for example a controlled parent clamping it) does not swallow moves near the stale committed point.