cad-editor/src/ui
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Karim Jerbi 32c3844526 perf(ribbon): stop building and laying out 5 panel renderings per frame
Each ribbon panel was rendered five ways every frame so CollapsePanels could
roll back to any density at layout time: full, compact, button, tight and a
full-size flyout that duplicated the full rendering.
The layout pass ran four full measure-layouts per panel even in forced modes,
and the degradation decision was an untested u8 inline in Ribbon::view.

Now the choice is a pure, unit-tested decide_levels() whose levels are a typed
Level enum (Full/Compact/Collapsed/Tight). Panel carries its four renderings
as elements: [Element; 4] indexed by Level, with a slot(i, level) helper for
the tree stride. Forced modes (Full/Compact/Collapsed) measure nothing at all
and derive the row height from the placed panel. The open flyout draws the
panel's own `full` rendering inside a self-drawn box (identical weakest-bg +
1px neutral-border to the container it replaced), so no duplicate
render_group is built per panel per frame. Level, Panel, Widths, CollapsePanels
and decide_levels are pub(crate); CollapseMode stays pub (re-exported).

Tests (collapse.rs tests module, added RED first):
- forced_modes_pin_every_panel
- auto_huge_width_keeps_everything_full
- auto_degrades_from_the_right_one_panel_at_a_time
- auto_stops_degrading_once_the_row_fits
- auto_escalates_a_single_panel_past_collapsed_to_tight
- auto_cascade_drops_every_collapsed_panel_to_tight
- auto_runs_the_compact_phase_across_the_row_first
- no_panels_stays_empty
- single_panel_walks_the_whole_ladder
- zero_widths_never_overflow
- endless_row_degrades_everything_to_tight
- unbounded_row_keeps_everything_full
- nan_budget_degrades_both_phases_but_no_tight_cascade
- exact_fit_at_full_stays_full
- matches_the_pre_refactor_algorithm: byte-equivalence sweep against the
  verbatim pre-refactor u8 algorithm (280 width/budget combos incl. the
  degenerate 0/0/inf/NaN inputs), proving the decision logic is unchanged.

Measured with the committed #[ignore]d benchmark
(`cargo test --lib --release -- --ignored --nocapture bench_ribbon_view_construction`)
run as one instrument across pre-change / this change: Ribbon::view()
construction ~676 -> ~425 us/frame (~37% of view construction saved); forced
modes run 1 layout call per panel per frame instead of 5.

Verification: cargo build clean; cargo test --lib = 382 passed (367 baseline
+ 15 new ribbon tests) / 2 known pre-existing failures unchanged
(save_then_open_round_trips, tilted_ucs_places_planar_entities_with_the_plane_normal).
2026-08-16 10:23:44 +01:00
..
popup feat(cursor): add crosshair options 2026-08-08 21:32:44 +03:00
ribbon perf(ribbon): stop building and laying out 5 panel renderings per frame 2026-08-16 10:23:44 +01:00
statusbar feat(cursor): add crosshair options 2026-08-08 21:32:44 +03:00
style feat(style): align mleader read-only field width with editable fields 2026-08-15 11:59:45 +01:00
window feat(plugin): harden V4 host integration 2026-08-15 20:17:43 +03:00
color_select.rs feat(plotstyle): improve CTB editor workflow 2026-08-10 19:09:40 -03:00
command_line.rs refactor(i18n): group Fluent attributes 2026-08-09 11:12:47 +03:00
dock.rs fix(dock): don't panic clamping panel width when window is minimized 2026-08-14 23:06:53 +01:00
icons.rs fix(ribbon): mask tools on start 2026-08-05 00:52:52 +03:00
mod.rs feat(read-only): add shared selectable read-only field helper 2026-08-15 11:59:44 +01:00
modal.rs fix(locale): stabilize web options 2026-08-02 23:14:48 +03:00
overlay.rs fix(view): correct 3D mesh interaction 2026-08-12 19:49:52 +03:00
properties.rs refactor(props): key active fields by a typed enum, not a sentinel string 2026-08-15 14:29:20 +01:00
read_only.rs feat(props): read-only rows use the shared selectable read-only field 2026-08-15 11:59:44 +01:00
side_toolbar.rs fix(ui): make modal layouts intrinsic 2026-07-30 14:47:28 +03:00
text_util.rs feat(ui): elide overflowing text, tooltip full layer name 2026-06-09 19:04:18 +03:00
wrap_bar.rs fix(ui): make modal layouts intrinsic 2026-07-30 14:47:28 +03:00