import type { JoystickShape, JoystickValue } from './types'; export declare const clampUnit: (value: number) => number; /** * Constrains a raw position to the control's shape. * * `circle` clamps the magnitude, so the handle rides the rim at full deflection * in every direction — the behaviour of a physical stick. `square` clamps each * axis on its own, letting the corners reach (±1, ±1), which is what an XY pad * needs so every combination of the two parameters is reachable. */ export declare const clampToShape: (x: number, y: number, shape: JoystickShape) => JoystickValue; /** * Zeroes small deflections and rescales what is left, so the value still spans * the full −1…1 range past the threshold instead of jumping to `deadZone`. * Without the rescale a stick with a dead zone can never report a value below it. */ export declare const applyDeadZone: (value: JoystickValue, deadZone: number, shape: JoystickShape) => JoystickValue; /** Snaps a single axis to `step`, then re-clamps (rounding can overshoot ±1). */ export declare const snapToStep: (value: number, step: number) => number; /** Kills float dust like `0.30000000000000004` in reported values and labels. */ export declare const roundValue: (value: number, precision?: number) => number; export declare const valuesEqual: (a: JoystickValue, b: JoystickValue) => boolean; export interface ResolveJoystickValueOptions { shape: JoystickShape; deadZone: number; step: number; lockAxis?: 'x' | 'y'; invertY: boolean; } /** * Turns a raw pointer offset from the centre, already divided by the travel * radius, into the value the component reports. */ export declare const resolveJoystickValue: (rawX: number, rawY: number, options: ResolveJoystickValueOptions) => JoystickValue; /** Value → on-screen offset in screen space (Y down), in normalized units. */ export declare const valueToOffset: (value: JoystickValue, invertY: boolean) => JoystickValue;