Make the contraption builder palette professional: collapsible sections + polish#25
Merged
Merged
Conversation
… polish Redesign the left palette (sidebar) of the Contraption Builder so it reads as intentional and is easier to scan, without changing any tool behaviour: - Collapsible accordion sections (SHAPES, TERRAIN, SPECIAL, VEHICLES, JOINTS) with clickable chevron headers. The scrollbar now appears only when the visible content actually overflows the viewport. - A fixed-width glyph gutter so every tool label lines up regardless of glyph width (the main "unpolished" tell), plus roomier rows and headers. - Selection-aware hover: idle/active state is derived from the current tool, not by matching a hardcoded pixel colour, so it never mis-reads an accent or fights the selected/collapsed styling. Easy wins folded in while reviewing the stack: - Unify the repeated chrome colours into one block of named constants (kCol*), routed through new setBtnIdle/setBtnActive helpers used by every styler. - Extract the remaining magic numbers (kDefaultMotorSpeed, kDefaultGravity). The UI runs only inside the LiveCode/OpenXTalk IDE, so this was verified by static review; runtime checks follow the manual checklist in the PR. https://claude.ai/code/session_01XpBcQg2DbncrBcFZLHqhMj
LiveCode case labels don't use a colon and the action goes on the following line; the C-style `case "SHAPES": return ...` form fails to compile. Rewrite to the canonical bare-label form used elsewhere in the file (toolHelp, dirName). https://claude.ai/code/session_01XpBcQg2DbncrBcFZLHqhMj
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 & why
The left palette (sidebar) of the Contraption Builder worked, but read as unpolished: a single long scrolling column of 26 buttons whose labels didn't line up (the glyph was baked into each button label, and the Unicode glyphs have different widths), behind a dated native scrollbar, with hover driven by a fragile hardcoded-colour string match and ~66 chrome colours hardcoded inline.
This PR makes it look intentional and easier to scan, without changing any tool behaviour. All work is in one file:
examples/box2dxt-contraption-builder.livecodescript.Changes
Collapsible (accordion) sections
▾expanded /▸collapsed).layoutPaletterepositions/shows/hides rows fromgPalOpenstate; hidden controls drop out of the group's scroll extent, so the scrollbar only appears when the visible content actually overflows.mouseUp→handleUiClickdispatch (newui_hdr_branch +togglePaletteSection) — no new card handler.mouseDownalready ignoresui_targets, so headers never disturb physics. Default is all sections expanded, preserving today's first-run discoverability.Visual polish
ui_g_<id>), centered, so every label lines up regardless of glyph width.Robust hover + selection (DRY)
setBtnIdle/setBtnActivehelpers are the single source of button styling, used byhighlightGroup,makeAction,makePropBtn,setToggle,highlightActions, and the inspector-tab highlighter.hoverToolnow derives idle/active state from the current selection (gTool/gJointTool), not from reading a pixel colour — it can't mis-read an accent or fight the selected/collapsed styling.Easy wins folded in
kCol*block (kColBtnIdle,kColAccentGreen,kColAccentAmber,kColDanger, …). Scene-part fill colours (red game pieces) are intentionally left as literals.kDefaultMotorSpeed(was120) andkDefaultGravity(was-10).A note on verification
This UI is LiveCode/xTalk script that runs only inside the LiveCode/OpenXTalk IDE — there's no headless way to run it in CI or a container, so I verified by careful static review (structure, handler balance, grouping/
clearUI/raiseUIconventions, coordinate math). All edits are script-and-control only, with no new external assets, so the standalone build is unaffected.Manual verification checklist (run in the IDE)
▾chevron, rule, and tool rows. All labels left-align (glyphs centered in the gutter).▸, rows hide, sections below slide up; click again → restores.ui_g_*orphans or duplicateui_palettescroll.https://claude.ai/code/session_01XpBcQg2DbncrBcFZLHqhMj
Generated by Claude Code