circuit-bricks
Version:
A modular, Lego-style SVG circuit component system for React (ALPHA - Not for production use)
73 lines • 1.95 kB
TypeScript
/**
* Touch and Mobile Utilities
*
* Utilities for handling touch interactions and mobile-specific functionality
* in Circuit-Bricks. Provides enhanced touch gesture support for circuit
* manipulation on mobile devices.
*/
import { Point } from '../schemas/componentSchema';
/**
* Touch gesture types
*/
export type TouchGesture = 'tap' | 'double-tap' | 'long-press' | 'pan' | 'pinch' | 'swipe';
/**
* Touch event data
*/
export interface TouchEventData {
type: TouchGesture;
startPoint: Point;
currentPoint: Point;
deltaX: number;
deltaY: number;
distance: number;
scale?: number;
velocity?: Point;
duration: number;
}
/**
* Touch gesture configuration
*/
export interface TouchConfig {
tapThreshold: number;
longPressDelay: number;
doubleTapDelay: number;
swipeThreshold: number;
swipeVelocityThreshold: number;
pinchThreshold: number;
preventDefaultOnTouch: boolean;
}
/**
* Hook for handling touch gestures
*/
export declare const useTouchGestures: (onGesture: (gesture: TouchEventData) => void, config?: Partial<TouchConfig>) => {
onTouchStart: (event: TouchEvent) => void;
onTouchMove: (event: TouchEvent) => void;
onTouchEnd: (event: TouchEvent) => void;
onTouchCancel: (event: TouchEvent) => void;
};
/**
* Hook for detecting device orientation
*/
export declare const useDeviceOrientation: () => "portrait" | "landscape";
/**
* Hook for safe area insets (for devices with notches)
*/
export declare const useSafeAreaInsets: () => {
top: number;
right: number;
bottom: number;
left: number;
};
/**
* Prevent zoom on double tap (iOS Safari)
*/
export declare const usePreventZoom: (enabled?: boolean) => void;
/**
* Detect mobile devices
*/
export declare const useIsMobileTouch: () => boolean;
/**
* Detect touch support
*/
export declare const useHasTouchSupportTouch: () => boolean;
//# sourceMappingURL=touchUtils.d.ts.map