feat(editor): indent guides, one caret column, and a band for the reference rows - #47
Closed
pythonlearner1025 wants to merge 1 commit into
Closed
pythonlearner1025 wants to merge 1 commit into
pythonlearner1025 wants to merge 1 commit into
Conversation
…erence rows The Objects tree drew no indent guides, and a row with no caret started 26 px left of a row with one. A mesh's reference rows from #42 therefore read as its children, and the next sibling mesh read as one of them. - Every row draws one vertical guide per ancestor. The guide comes from the depth class the row already indents by, so the two can never disagree. - The caret column is 26 px on every row, empty when there is nothing to open. A row with no icon keeps an icon column the same way. - A reference row's own levels draw a dotted guide, not a solid one. - The reference rows of one object carry a tint and a 2 px rule at their left, from the first reference to the last. - The depth classes run to 20, the range Blueprint defines, so a row deeper than ten keeps our 10 px step. Proved headless on /Users/minjunes/games/terminator-next at 1512x982. At one depth every row now shares its caret x and its icon x: the geometry row's icon moved from 60 to 86, where the material row's already was. The texture rows' icons moved from 70 to 96, clear of the depth 5 mesh at 76. Click, double click, drag and the context menu read byte for byte the same before and after. npm run typecheck, npm run lint, npm test -w packages/kite3d (8 tests) and npm run test:scripts (2 tests) all pass.
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.
What part this touches
The Objects panel of the Kite3D editor, and the tree it draws.
packages/editor/src/components/Tree2.tsxis the editor's own copy of Blueprint's tree.TreeNode2.tsxdraws one row: a caret, an icon, a name.tree2.scssstyles both.BPHierarchyComponent.tsxfills the tree with the scene.Since #42 a mesh also gets reference rows under it. A reference row is the mesh's geometry, one of
its materials, or a texture slot of a material. A reference row points at a resource. It is not a
child: the same resource appears under every object that uses it, and nothing there can be dragged,
reordered or deleted.
This change is the "Chosen" card of the owner's mock,
tree-options.html.The problem
Open a mesh in the Objects tree. Its reference rows read as its children. The next sibling mesh
reads as one of them too.
Two causes. I measured both on
/Users/minjunes/games/terminator-next, headless, at 1512x982.The branch is Map, Bunker_7, Walls, Wall_segment_1, Wall segment asset, Wall segment concrete.
First, a row with no caret started 26 px left of a row with one. This rule collapsed the caret slot:
So rows at one depth began at different x. Both of these rows sit at depth 6:
(BufferGeometry)Map concreteThe texture rows at depth 7 put their icons at x 70. The mesh at depth 5 put its icon at x 76.
A row two levels deeper started 6 px further left than its own grandparent.
Second, the tree drew no indent guides. Nothing marked where a subtree ended. The last texture
row's name sat at x 105. The next sibling mesh
Wall segment rustput its name at x 102. Threepixels apart, so the mesh read as one more reference.
The fix
bp5-tree-node-content-Nclass the row already indents by.The guides and the indent can never disagree.
Its name then starts where its siblings' names start.
the first reference and ends at the last.
editor's 10 px step instead of falling back to Blueprint's 23 px.
Two files changed:
packages/editor/src/components/tree2.scssandTreeNode2.tsx. The stylesheetdoes all the drawing. The component change is one empty span for the icon column.
The risk trade
The cost is horizontal space. A row with no caret gains 26 px, and a row with no icon gains 26 px.
In the Resources tab all 760 rows are flat leaves with no caret. Every one of them moves 26 px
right and gains nothing.
What lowers the cost: the tree already scrolls sideways, and the panel already resizes. On this
scene the open branch measured 325 px against a 276 px viewport before the change. The panel
scrolled already. Scrolled right, the names read in full, and the band scrolls with the rows.
The rejected alternative is option C of the mock: chips on the mesh row, and no reference rows at
all. It costs no rows and cannot be misread. It also drops the geometry name and the texture slots
from the tree. The owner picked the rows.
I also rejected leaving the caret column at zero and marking the references with the band alone.
The band would then hide a real defect: rows at one depth would still begin at different x.
Tests
No automated test is added.
AGENTS.mdbans proactive tests, and this is a stylesheet change withno reported flake behind it. The proof is the manual headless run.
Every run used Playwright with the owner's Google Chrome, headless, viewport 1512x982, device pixel
ratio 2, a fresh profile. Nothing took focus. Every server ran with
CI=1. I never rankite3d install.I confirmed before each run that the served editor was my build. I fetched each asset from the
server and matched its sha256 against
packages/editor/dist/assets. All three matched both times.The columns, before and after
The same branch, opened down to the first mesh's references and its material's texture slots.
"caret slot x" is the row's left edge plus its indent, which is where the caret sits.
Wall segment concrete, beforeWall segment concrete, after(BufferGeometry), before(BufferGeometry), afterMap concrete, beforeMap concrete, afterWall segment rust, beforeWall segment rust, afterAfter the change every row at one depth shares its caret x and its icon x. The gap between the
texture names and the next sibling mesh's name grew from 3 px to 29 px.
What fails without the fix
I rebuilt the editor from
git stash, served it, and ran the same scripts. The table above is thatrun. Without the fix the geometry row and the material row sit at one depth. Their icons are 26 px
apart. The sibling mesh's name lands 3 px from the texture names.
The band
after-report.jsonreads the computed background of each row around the block. Seven referencerows carry the band: the geometry, the material, and the material's five texture slots. The mesh
above it, the sibling mesh below it, and the next asset row all read
background-image: none.The screenshots I looked at
All under
/private/tmp/claude-501/-Users-minjunes-blitz/278f5f97-7e16-4722-b1bc-c061014966db/scratchpad/evidence/tree-reference-rows/.compare-before-after.png: the panel before and the panel after, side by side.compare-after-mock.png: the panel after, beside the "Chosen" card of the mock. The guides, thedotted levels, the tint and the left rule read at the same weight.
zoom-band-hover.png: the block at three times size, with a reference row hovered. The hovercolour still shows through the tint.
shots/after-light-objects-expanded.png: the light theme. One colour token serves both themes.shots/after-resources.png: the Resources tab. Its rows are all at depth 0, so no guides aredrawn, and the rows read as before.
shots/after-scrolled-right.png: the tree scrolled 38 px right. The band scrolls with the rows.shots/after-dark-mesh-closed.png: the mesh closed. The band goes with its rows.zoom-selected-row.png: a selected row with the context menu open. The band and the selectionhighlight end at the same x, which is the tree's scrollport edge.
The edges
stylesheet instead, on a hidden probe row. Depths 1, 5, 10, 11, 12 and 20 all answered
padding-leftand guide width of 10 px times the depth.after-deep.json.background-color: rgba(143, 153, 168, 0.15)under theband, so the hover still reads. Dark and light both.
out of view with the rest of the row. The selection highlight does the same.
a block of one row. No special case exists to break.
No change in behaviour
I ran the same script against the build before the fix and the build after it. The two reports are
equal, field for field:
behaviour-diff.txtsaysidentical: True.bp5-tree-dragging-node, and drops it on drag enddraggableon a reference rowfalseZero page errors in every run.
The suites
Deploy
The editor bundle ships it.
@kite3d/editorholds the stylesheet, andkite3d devserves thatpackage's
dist. Nothing inpackages/kite3dchanged.To roll back, publish the previous
@kite3d/editorfrom npm, version 0.21.0-alpha.5. A user on anolder
kite3dkeeps the old editor, becausekite3dpins the editor version it depends on.🤖 Generated with Claude Code