import { type ReferenceTagStack } from "../math/referenceTagStack"; import { Gesture } from "react-native-gesture-handler"; import { type SharedValue } from "react-native-reanimated"; import type { ChartEngineLayout } from "../core/useLiveChartEngine"; import type { ChartPadding } from "../draw/line"; import type { ReferenceLine } from "../types"; /** * Builds the per-line **drag** gesture for draggable Form-A reference lines: grab a * line near its value-Y and drag vertically to set a new value, with optional * `snap` + `bounds` clamp. Mirrors the order-ticket reticle in {@link useCrosshair} * (value↔Y via `computeValueAtY` / `pinnedPlotY`, frozen value re-projected * each frame) but per line, writing the value the finger sets into the shared * `dragValues` array (what the range fit reads). The overlays read `drawnValues`. * * The pan uses `manualActivation`: it grabs only when a touch starts within * {@link GRAB_SLOP} of a draggable line (and inside its `grabRange`, when it has * one), then **owns** that touch — any drag past * {@link DRAG_ACTIVATE_PX} (in either axis) drags the line. A touch off every line * fails fast so the chart's other gestures (scrub / scroll) run everywhere else * (compose this ahead of them via `Gesture.Exclusive`). Crucially it no longer * falls through to scrub on a horizontal start, so a drag begun on a line always * wins the race rather than dropping a scrub crosshair (#163). * * The dragged line stays under the finger: `drawnValues` re-maps it from the * finger's last Y whenever the range changes, or the plot is resized, while the * finger rests. `dragValues` keeps the value the finger last set. If another line * takes the dragged line's index mid-drag (lines added or removed before it, told * apart by `id`), the drag lets go: it moves and commits nothing, and * gives that line back its own value immediately. This touch stays cancelled if * the original line later returns to the grabbed index. * * Also fires the per-line drag callbacks: `onChange` (as the finger moves the * line, de-duped to value changes, and once more on release if the line was * drawn elsewhere), `onCommit` (on release, with the value under the finger), * and `onDragIn` / `onDragOut` (drawn value crossing the visible * range or a `bounds`, from a drag or the axis rescaling — edge-detected each frame). */ export declare function useReferenceDrag(engine: ChartEngineLayout, padding: ChartPadding, lines: ReferenceLine[], dragValues: SharedValue, dragActive: SharedValue, enabled: boolean, tagStack?: SharedValue): { gesture: ReturnType; /** True when a touch at (x,y) would grab a draggable line — lets the scrub * gesture decline that press so it never drops a crosshair on a line (#163). */ hitTest: (x: number, y: number) => boolean; /** `dragValues` with the line being dragged kept under the finger, re-mapped * against the current range. What the lines' overlays, grouping and press * hit-test read; the range fit reads `dragValues`. */ drawnValues: SharedValue; }; //# sourceMappingURL=useReferenceDrag.d.ts.map