Repository navigation
Add ReorderableTree, a drag-reorderable tree of caller-drawn rows - #588
Merged
Merged
Conversation
…nor] The caller flattens its tree into rows and draws each row's content; the widget lays them out, shows where a drag would land, and reports the move on release as a ReorderableTreeMove whose index counts the new parent's children before the move. ReorderableTreeState resolves drops without ImGui: the quarters of a container drop beside it and the middle half inside, a leaf splits at the middle, the pointer's x picks how far out a drop below the end of a subtree lands, and drops into the dragged row's own subtree or back where it was are refused. A press in a text field is left to the field. Ships with state tests, an isolation suite, a demo section, a demo UI test and a gallery tile. Asked for by ImageGui's layers panel (M5b). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RU5HC3D44CgGTP97XE4WQz
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RU5HC3D44CgGTP97XE4WQz
|
This was referenced Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Requested by Matt · project thread
Before:
ktsu.ImGui.Widgetshad no tree whose rows can be dragged.Treedraws connector lines around content and has no rows, andIconTreeNodeis a Hexa adapter that probes cannot see.After:
ImGuiWidgets.ReorderableTree(label, rows, drawRow)lays out rows the caller draws, shows an insertion line or a container highlight while a row is dragged, and on release returns aReorderableTreeMove(row, new parent row, insertion index). It never applies the move, so the caller's own model and undo history do.This is the widget ImageGui's M5 layers spec asks for in M5b, so the layers panel can reorder and re-parent by drag.
How:
ReorderableTreeStateresolves the drop with no ImGui dependency, following theHandleTrack/CurveTrackpattern. The top and bottom quarters of a container drop beside it and the middle half inside. A leaf splits at the middle. Below the last row of a subtree, the pointer's x picks how far out the drop lands. A drop into the dragged row's own subtree, or one that would leave it where it was, is refused.Indexcounts the parent's children before the move, which the README and a test both pin. A press in a text field is left to the field, so selecting text in a rename box doesn't pick the row up. Every row is marked for probes asrow{i}inside the tree's label.Ships with 26 state tests, an 11-test isolation suite, a demo section with a demo UI test, a gallery tile, and the README and CLAUDE.md entries. Locally,
ImGui.Widgets.Tests,ImGui.Widgets.UITests,ImGuiWidgetsDemo.UITestsandWidgetGallery.UITestsall pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01RU5HC3D44CgGTP97XE4WQz
Generated by Claude Code