Skip to content

Add collection item dragging with Hierarchy reordering - #197

Merged
snkmcb merged 2 commits into
mainfrom
codex/hierarchy-drag-drop
Nov 11, 2026
Merged

snkmcb merged 2 commits into
mainfrom
codex/hierarchy-drag-drop

Conversation

@snkmcb

@snkmcb snkmcb commented Nov 10, 2026

Copy link
Copy Markdown
Member

Summary

This is the first slice of the proposed typed drag and drop: moving one item within a single ListView or TreeView.

  • Public API. Adds CollectionDragDispatcher and collection_drop_target in collection_drag.hpp. No new document vocabulary, roles or semantic state.
  • Clicks still work. The dispatcher observes a row press without consuming it, so click selection and focus on press behave as before.
  • Drag behavior. After a 4-unit threshold (configurable), the result reports started and the host resets the ordinary pointer press. Moves report the source key and a before/after insertion point at the nearest displayed row. The release reports it as drop; releasing outside the collection cancels.
  • Cancellation. Escape, Cancel and PointerCancel cancel and are consumed. Other key, text and logical input cancels unconsumed.
  • Replacement. refresh recomputes the target at the last position, so a wheel scroll moves the insertion point. It cancels when the collection or the dragged row disappears, collapses away or becomes disabled.
  • Inspector: typed drop command. Scene's children are reordered through a node-free item.move command (item/target object IDs, placement enumeration), resolved with CommandSnapshot::resolve over published item IDs. Moving Scene, dropping before Scene and no-op drops reject with item_move. Item data, selection and focus are kept.
  • Inspector: feedback and keyboard. The dragged row is dimmed to 45% opacity and a valid target shows a two-unit blue inset band on its top or bottom edge. Alt+Up/Down is the keyboard equivalent. A help line describes both.
  • Docs. New input architecture section (the proposal section now names what remains), TreeView/ListView guide section, Inspector section, support matrix, testing table, backlog and changelog.

Verification

  • New owner test collection_drag: insertion points (halves, gaps, below rows, clipping, collapsed and disabled), threshold, click pass-through, toggles, drag/drop, cancellation paths, scroll and replacement refresh, rejection.
  • inspector_hierarchy window-free smoke: new reorder_smoke. The injected native smoke drags Light below Camera with Windows mouse messages under OS capture.
  • Debug: all 98 non-native tests pass.
  • Release: collection_drag, inspector_hierarchy and inspector_hierarchy_native pass.
  • scripts/check-docs.ps1 passes. Formatted with clang-format 23.1.1.

This PR is independent of #196 (number scrubbing). Both edit examples/inspector-hierarchy/main.cpp, CHANGELOG.md and the Inspector guide, so whichever merges second needs a small rebase.

Not included

Payload types beyond item keys, copy/link operations, drag previews, dragging between collections or into other targets, external OS drags, automatic scrolling while dragging, reparenting, transactions/history and native accessibility.

🤖 Generated with Claude Code

snkmcb and others added 2 commits November 11, 2026 03:27
CollectionDragDispatcher reports before/after insertion points while a
ListView or TreeView row is dragged past a threshold, without consuming
the press, so clicks still select. Escape, Cancel and PointerCancel
cancel; refresh recomputes the target after scrolling.

The Inspector reorders Scene's children through a node-free typed
item.move command over published item IDs, with dimmed source,
inset insertion band and Alt+Up/Down.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Combine Hierarchy drag reordering with NumberInput scrubbing: both
dispatchers route after the popups, and both smokes and docs remain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@snkmcb
snkmcb merged commit 6d75bfe into main Nov 11, 2026
3 checks passed
@snkmcb
snkmcb deleted the codex/hierarchy-drag-drop branch November 11, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant