diff --git a/.agents/skills/verify-screens/features/move-select.md b/.agents/skills/verify-screens/features/move-select.md index 4a80106..69d9057 100644 --- a/.agents/skills/verify-screens/features/move-select.md +++ b/.agents/skills/verify-screens/features/move-select.md @@ -7,6 +7,7 @@ With the Move tool a person selects frames, drags one or several, snaps them to - `sel-click`: a click selects, giving a ring and the Focus action; the page takes the pointer. A click on the background clears it. - `sel-marquee`: a background drag selects every frame it intersects. Escape mid-drag cancels it. - `drag-commit`: a drag shows pending until the commit, then commits one `moveItems` at the start plus the screen delta divided by zoom. +- `drag-threshold`: a press that wobbles less than 5 screen px selects a frame without moving it, even zoomed out. Moving 5 px or more starts the move. - `drag-snap`: an edge within 8 screen px of another frame snaps exactly. Holding Cmd or Ctrl turns snapping off. - `delete`: Backspace removes the selection and the strokes drawn on it. - `rename`: double-clicking a title or clicking the Screen name edits it; Enter commits. The agent's `retitle_item` and `rename_screen` do the same. @@ -51,6 +52,18 @@ expect doc.rev=+1 doc.@A.x=100 doc.@A.y=-50 storage.rev=doc.rev events.revisions diff ``` +```screens id=drag-threshold +add_object title=A files=fixture:plain x=0 y=0 width=800 height=600 as=@A +add_object title=B files=fixture:plain x=2000 y=1500 width=800 height=600 as=@B +fit +mark +drag @A by 4,0 +expect view.selection=[@A] doc.@A.x=0 doc.rev=+0 +click bg +drag @A by 6,0 +expect view.selection=[@A] doc.@A.x>0 doc.rev=+1 +``` + ```screens id=drag-snap add_object title=L files=fixture:plain x=0 y=0 height=300 as=@L add_object title=R files=fixture:plain x=600 y=40 height=300 as=@R diff --git a/packages/canvas/src/engine/controller.ts b/packages/canvas/src/engine/controller.ts index 5ae7f1e..69ee109 100644 --- a/packages/canvas/src/engine/controller.ts +++ b/packages/canvas/src/engine/controller.ts @@ -12,7 +12,9 @@ import { round2 } from "./stroke.ts"; import { isUnsaved, type BaseDoc, type DisplayItem, type DisplayThread } from "./display.ts"; import { gridColumns, PRESENT_KEYS, SCROLL, fitExact, fitTop, gridRect, policyOf, scrollRect, shownDocOf, slotAmong, type PagesState, type PagesView } from "./pages.ts"; -export const DRAG_THRESHOLD_PX = 3, PAN_MOVED_PX = 3, TRANSIENT_INTERVAL_MS = 33, PIN_DRAG_PX = 4; +/** A press on a frame moves it only past DRAG_THRESHOLD_PX on screen, so a click that wobbles still only selects. + * A resize handle is pressed on purpose, so it starts sooner, for small resizes. */ +export const DRAG_THRESHOLD_PX = 5, RESIZE_THRESHOLD_PX = 3, PAN_MOVED_PX = 3, TRANSIENT_INTERVAL_MS = 33, PIN_DRAG_PX = 4; export const STROKE_DRAW_PX = 4, STROKE_SPACING_PX = 0.75, STROKE_MAX_POINTS = 3000; export const VIEW_COMMAND_TTL_MS = 30_000; @@ -50,7 +52,7 @@ export type Gesture = /** Grid view of a Presentation or Document: the drag reorders. slot is where the pages would go (reorderItems' index). */ readonly reorder: boolean; readonly slot: number | null } /** starts: each selected item's rect at press; box: their bounds, which the handle resizes, scaling every item with it. - * preview holds every item's full rect once past DRAG_THRESHOLD_PX. */ + * preview holds every item's full rect once past RESIZE_THRESHOLD_PX. */ | { readonly kind: "item-resize"; readonly pointerId: number; readonly gestureId: string; readonly origin: Point; readonly starts: ReadonlyMap; readonly kinds: readonly string[]; readonly handle: Handle; readonly box: Rect; readonly limits: SizeLimits; readonly targets: readonly Rect[]; readonly preview: ReadonlyMap | null; readonly guides: readonly Guide[]; readonly lastBroadcastAt: number; readonly unsent: boolean } @@ -561,7 +563,7 @@ function gestureMove(s: ViewState, g: Gesture, i: Extract();