From b3403aef9b011e9a5336d335335e7a9a13165910 Mon Sep 17 00:00:00 2001 From: pythonlearner1025 Date: Wed, 16 Sep 2026 17:44:18 -0700 Subject: [PATCH] feat(editor): indent guides, one caret column, and a band for the reference 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. --- packages/editor/src/components/TreeNode2.tsx | 7 +- packages/editor/src/components/tree2.scss | 70 ++++++++++++++++++-- 2 files changed, 69 insertions(+), 8 deletions(-) diff --git a/packages/editor/src/components/TreeNode2.tsx b/packages/editor/src/components/TreeNode2.tsx index 044c67eb..7cc05b2f 100644 --- a/packages/editor/src/components/TreeNode2.tsx +++ b/packages/editor/src/components/TreeNode2.tsx @@ -15,6 +15,7 @@ * * Changes: * - Added support for drag and drop + * - A row with no icon still gets an icon column */ import classNames from "classnames"; @@ -102,7 +103,11 @@ export class TreeNode2 extends React.Component> {
  • {this.maybeRenderCaret()} - + {/* A row with no icon keeps the column. Blueprint's Icon draws nothing without + one, and the name would then start where a row with an icon puts its icon. */} + {icon + ? + : } .bp5-tree-node-content{ + background-image: + linear-gradient(rgba($tree-chrome, 0.35), rgba($tree-chrome, 0.35)), + linear-gradient(rgba($tree-chrome, 0.07), rgba($tree-chrome, 0.07)); + background-repeat: no-repeat; + background-size: 2px 100%, 100% 100%; + + &::after{ + bottom: 0; + content: ""; + pointer-events: none; + position: absolute; + top: 0; + right: calc(100% - #{$tree-indent} * var(--tree-depth)); + width: calc(#{$tree-indent} * var(--tree-reference-depth)); + background-image: repeating-linear-gradient(to right, transparent 0 4px, rgba($tree-chrome, 0.35) 4px 5px, transparent 5px $tree-indent); + // 2 on and 3 off divides the 30px row, so the dots hold their phase from row to row. + mask-image: repeating-linear-gradient(to bottom, #000 0 2px, transparent 2px 5px); + } +} + // A preview light belongs to the document view, not to the file it shows. .tree-node-excluded > .bp5-tree-node-content .bp5-tree-node-label{ opacity: 0.5;