mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 02:34:21 +00:00
fix(planner): let tablets drag places into the day plan (#1616)
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.
This commit is contained in:
@@ -52,6 +52,7 @@ import { useTripPlanner } from './tripPlanner/useTripPlanner'
|
||||
import { usePoiExplore } from '../components/Map/usePoiExplore'
|
||||
import PoiCategoryPill from '../components/Map/PoiCategoryPill'
|
||||
import { useIsPhone } from '../mobile/useIsPhone'
|
||||
import { useTouchDragBridge } from '../hooks/useTouchDragBridge'
|
||||
import MTripShell from '../mobile/screens/trip/MTripShell'
|
||||
|
||||
function ListsContainer({ tripId, packingItems, todoItems }: { tripId: number; packingItems: PackingItem[]; todoItems: TodoItem[] }) {
|
||||
@@ -227,6 +228,11 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
mapTileUrl, fontStyle, splashDone,
|
||||
} = useTripPlanner()
|
||||
|
||||
// Tablets run this very layout but cannot start an HTML5 drag with a finger,
|
||||
// so a long press stands in for one (#1616). Only where the pointer is
|
||||
// coarse — a hybrid laptop loads drag-drop-touch instead.
|
||||
useTouchDragBridge(isTouch && !isMobile)
|
||||
|
||||
const poi = usePoiExplore()
|
||||
const [glMap, setGlMap] = useState<CompassMap | null>(null)
|
||||
const poiPillEnabled = useSettingsStore(s => s.settings.map_poi_pill_enabled) !== false
|
||||
@@ -379,7 +385,6 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
}}>
|
||||
<DayPlanSidebar
|
||||
isMobile={isMobile}
|
||||
isTouch={isTouch}
|
||||
tripId={tripId}
|
||||
trip={trip}
|
||||
days={days}
|
||||
@@ -491,7 +496,6 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
pushUndo={pushUndo}
|
||||
days={days}
|
||||
isMobile={false}
|
||||
isTouch={isTouch}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -298,7 +298,7 @@ export function useTripPlanner() {
|
||||
mq.addEventListener('change', handler)
|
||||
return () => mq.removeEventListener('change', handler)
|
||||
}, [])
|
||||
// Layout is width-driven (isMobile); drag affordances are pointer-driven (isTouch).
|
||||
// Layout is width-driven (isMobile); the drag bridge is pointer-driven (isTouch).
|
||||
// Conflating them is what left a tablet's places list undraggable-but-unscrollable (#1432).
|
||||
const isTouch = useIsTouch()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user