mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
edea67ff7e
Dragging a place from the right pane to the left one did nothing on an iPad or a Samsung tablet — the row was selected as text instead. Phones never reach this layout, they get the mobile shell below md, so the coarse pointer check in dragDisabled was only ever switching tablets off. It was also doing that for a reason that had gone away. What swallowed the scroll gesture in #1432 was the drag-drop-touch polyfill, and that has been confined to hybrid laptops since. Width is the gate that still means something: below lg the plan and the places are separate tabs, so there is nothing to drag between. So touch is no longer a reason to disable the drag, and the planner arms the long-press bridge instead where the pointer is coarse. Rows get -webkit-touch-callout and user-select off there too, otherwise the press that starts the drag brings up the selection first. The isTouch prop had no other use and is gone, along with a comment claiming arrow reorder buttons take over on touch — there are none.
18 lines
628 B
TypeScript
18 lines
628 B
TypeScript
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])
|
|
}
|