diff --git a/crates/op-editor-ui/src/widgets/variables_panel.rs b/crates/op-editor-ui/src/widgets/variables_panel.rs index 554218fc4..21ac38b38 100644 --- a/crates/op-editor-ui/src/widgets/variables_panel.rs +++ b/crates/op-editor-ui/src/widgets/variables_panel.rs @@ -776,3 +776,5 @@ impl Widget for VariablesPanel { #[cfg(test)] mod tests; +#[cfg(test)] +mod wash_tests; diff --git a/crates/op-editor-ui/src/widgets/variables_panel/paint.rs b/crates/op-editor-ui/src/widgets/variables_panel/paint.rs index fef4a324a..e20db783e 100644 --- a/crates/op-editor-ui/src/widgets/variables_panel/paint.rs +++ b/crates/op-editor-ui/src/widgets/variables_panel/paint.rs @@ -279,13 +279,16 @@ fn paint_variant_header( let variant_width = cx.backend.measure_text(variant, 13.0); // Hover/press wash hugs `value v` (+ small L/R padding) instead of // washing the whole value-column cell. The hit target stays the - // wider `variant_header_rect` so the trigger is still easy to click. + // wider `variant_header_rect` so the trigger is still easy to click, + // and the wash is clamped to that hit column so a long variant name + // can't bleed into the neighbouring variant column. + let wash_left = x - HOVER_WASH_PAD_X; + let cell_right = wash_left + col_w.min(176.0); + let wash_right = + (wash_left + variant_width + 6.0 + 11.0 + HOVER_WASH_PAD_X * 2.0).min(cell_right); let wash = Rect { - origin: Point2D::new(x - HOVER_WASH_PAD_X, header_bottom + 4.0), - size: Point2D::new( - variant_width + 6.0 + 11.0 + HOVER_WASH_PAD_X * 2.0, - 30.0, - ), + origin: Point2D::new(wash_left, header_bottom + 4.0), + size: Point2D::new((wash_right - wash_left).max(0.0), 30.0), }; paint_feedback(panel, cx, VariablesPanelButton::VariantHeader(idx), wash, 8.0); paint_text( diff --git a/crates/op-editor-ui/src/widgets/variables_panel/tests.rs b/crates/op-editor-ui/src/widgets/variables_panel/tests.rs index 424e6adc7..8154c9754 100644 --- a/crates/op-editor-ui/src/widgets/variables_panel/tests.rs +++ b/crates/op-editor-ui/src/widgets/variables_panel/tests.rs @@ -813,85 +813,6 @@ fn axis_chip_table_mirrors_active_theme_btree_order() { assert_eq!(p.chips[1].axis, "z-axis"); } -// ── fit-content hover wash (#26 variant header + #3 add-variable footer) ───── -// -// Both the variant-header value (`Default v`) and the footer `+