Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

628 B
Raw Blame
import { useEffect } from 'react'
import { installTouchDragBridge } from '../utils/touchDragBridge'

/**
 * Arms the planner's long-press touch drag while `enabled` (#1616).
 *
 * Deliberately not armed on hybrid laptops: their primary pointer is fine, so
 * `drag-drop-touch` is loaded there instead (see utils/touchDragPolyfill) and
 * two bridges would fight over the same gesture. The two conditions cannot
 * both hold — a pointer is either coarse or fine.
 */
export function useTouchDragBridge(enabled: boolean): void {
  useEffect(() => {
    if (!enabled) return
    return installTouchDragBridge()
  }, [enabled])
}