Skip to content

Feature Template Navigation Menu

Brennan Hatton edited this page May 11, 2026 · 1 revision

Template navigation menu

Since: v0.135.0 — PR #176

Replaces the per-row "type menu" panels with a wider template navigation menu anchored at every variant row. One panel now exposes the whole editor surface: category buttons across the top, every type in the current category as a side-by-side strip, the row's own variant list expanded in place, and sub-variants rendered inline next to every variant that has children. Wherever an author walks in the editor world, the full nav is one row away.

Layout

+-----------------------------------------------------+
|  Carriages | Contents | Tracks                      |  ← category bar
+--------------+--------+--------+--------+-----------+
|  Carriages   | Floor  | Walls  |  Roof  |  Doors    |  ← type-tab strip
+--------------+--------+--------+--------+-----------+
| standard ×20 | [child_a] [child_b]                  |
| windowed ×20 |                                      |  ← expanded variant
| flatbed   ×1 |                                      |    list on the left,
| + New        |                                      |    sub-variant cells
+--------------+--------------------------------------+    on the right
  • Category bar. Carriages | Contents | Tracks across the top. The active category is tinted green. Clicking a button runs /dt editor <id> (same teardown + teleport as typing the command). ARCHITECTURE is filtered out until the category has stamped plots.
  • Type-tab strip. Every type within the active category gets a tab. The tab matching the row the player is standing in is expanded (yellow, leftmost); every other tab collapses to just its type-name header in dim grey. Clicking a collapsed tab teleports to that type's first variant.
  • Expanded variant list. Same content as the legacy single-column type menu: variant name (teleport on click), weight ×N cell (+1 / shift -1), provenance tints (blue = user-authored, orange = imported), green active-row tint for the variant the player is physically standing in, + New footer.
  • Inline sub-variants. Every variant carries its own children list (server populates from CarriageContentsGroupStore for CONTENTS variants). The renderer draws each child as a clickable cell to the right of its parent's row — not just for the active variant. Provenance tints and the active-row green carry through onto the cell.

Sizing & wrap

The menu sizes itself in two steps:

  1. Base width = tabs + the reserved minimum sub-variant area (SUB_VARIANT_AREA_MIN_W). Panel reads as having "room for" sub-variants even when none exist.
  2. Needed width = tabs + the widest single sub-variant row (no wrap).
  3. Actual width = min(needed, base × 2.25). (NAV_WIDTH_GROWTH_CAP.)

When a variant's sub-variants don't fit at the capped width, the overflow wraps to a second line below the variant row. Subsequent variants shift down by the wrap count. Hard cap at two lines per variant — anything past that is truncated rather than expanding the panel vertically.

Reorder — variant list always on the left

Each anchor renders the menu whose typeName matches its own row's type, and the expanded tab is always at the leftmost position in the strip. So at the Floor row, the panel reads Floor | Carriages | Walls | Roof | Doors; at the Doors row, Doors | Carriages | Floor | Walls | Roof. The variant list lives in the same screen position regardless of which row the player is at — players can find what they're editing without scanning across.

Standalone sub-variants companion — unchanged

The floating companion panel that anchors next to the per-plot label (see Editor floating panels) and lists the active variant's children with the sub-variant weight editor from v0.134.0 (PR #175) is untouched. Same code path, same behaviour — the new nav menu adds the inline cells alongside, it doesn't replace the companion.

Networking

EditorTypeMenusPacket.Menu gained three fields (populated only on row-start nav panels):

  • activeCategoryId — drives the green tint on the category bar.
  • categoryBar — ordered List<CategoryButton> (id + display name).
  • typeStrip — ordered List<TypeTab> (type name + first-variant teleport target).

Variant gained a recursive subVariants list — server populates from the group store for CONTENTS variants, empty for everything else.

Legacy convenience constructors are preserved so the sub-variants companion (built by VariantOverlayRenderer) and any other existing call site continue to compile and serialise unchanged. Server and client must ship as a matched pair (standard for this mod).

Files

Layer File
Wire format src/main/java/games/brennan/dungeontrain/net/EditorTypeMenusPacket.java
Server builder src/main/java/games/brennan/dungeontrain/editor/EditorTypeMenus.java
Client renderer src/main/java/games/brennan/dungeontrain/client/menu/plot/EditorTypeMenuRenderer.java
Click dispatch src/main/java/games/brennan/dungeontrain/client/menu/plot/EditorTypeMenuInputHandler.java

Clone this wiki locally