Scroll equalizer card from hint
Browse files at this commitdd96126513013ceda325115d9b19809e3f84af25Parent: e78c741- fix
- scroll equalizer card from hint
2 changed files +44 -12
- crates/app/src/tests/cards.rs +33 -0
- crates/app/src/ui/cards.rs +11 -12
crates/app/src/tests/cards.rsmodified+33 -0
| @@ -1770,6 +1770,39 @@ fn a_cards_own_help_paints_while_the_card_is_open_but_the_ui_under_it_stays_quie | ||
| 1770 | 1770 | ); |
| 1771 | 1771 | } |
| 1772 | 1772 | |
| 1773 | +/// Structural guard only: this binary has no `TestAppContext`, so it cannot | |
| 1774 | +/// mount the card, aim at its hint, wheel it, or read painted movement. A | |
| 1775 | +/// driving pass must still prove a wheel over the hint changes card pixels. | |
| 1776 | +/// This pins the declaration-level invariant that the EQ card's outer | |
| 1777 | +/// container, which also owns the hint sibling, owns `eq_scroll`; putting the | |
| 1778 | +/// handle back on `eq-card-rows` recreates that hint's dead zone. | |
| 1779 | +#[test] | |
| 1780 | +fn eq_cards_scroll_handle_belongs_to_the_container_that_also_holds_its_hint() { | |
| 1781 | + let card = fn_body("eq_card"); | |
| 1782 | + let card_at = card.find(".id(\"eq-card\")").expect("EQ card container"); | |
| 1783 | + let rows_at = card.find(".id(\"eq-card-rows\")").expect("EQ card rows"); | |
| 1784 | + let container = &card[card_at..rows_at]; | |
| 1785 | + | |
| 1786 | + assert!( | |
| 1787 | + container.contains(".overflow_y_scroll()") | |
| 1788 | + && container.contains(".track_scroll(&self.eq_scroll)"), | |
| 1789 | + "eq_scroll must belong to eq-card, the container that also holds the \ | |
| 1790 | + below-fold hint, rather than a body-only child" | |
| 1791 | + ); | |
| 1792 | + | |
| 1793 | + let rows = &card[rows_at..]; | |
| 1794 | + assert!( | |
| 1795 | + !rows.contains(".track_scroll(&self.eq_scroll)"), | |
| 1796 | + "eq-card-rows owns eq_scroll again -- its sibling hint becomes a \ | |
| 1797 | + wheel dead zone" | |
| 1798 | + ); | |
| 1799 | + assert!( | |
| 1800 | + rows.contains("more below — scroll the card"), | |
| 1801 | + "the below-fold hint disappeared; this guard must cover the child it \ | |
| 1802 | + keeps in the card's wheel surface" | |
| 1803 | + ); | |
| 1804 | +} | |
| 1805 | + | |
| 1773 | 1806 | /// "Maximize a card in place" changes size only, never the relative |
| 1774 | 1807 | /// semantics a value is drawn against: `eq_x`/`eq_y` map into `0..1` of |
| 1775 | 1808 | /// whatever box they are given, so a wider/taller EQ card is genuinely more |
crates/app/src/ui/cards.rsmodified+11 -12
| @@ -1560,14 +1560,19 @@ impl Player { | ||
| 1560 | 1560 | // outright hung the card's right-hand third off the edge |
| 1561 | 1561 | // of the window. The two cards beside it are built this |
| 1562 | 1562 | // way for the same reason. |
| 1563 | + .id("eq-card") | |
| 1563 | 1564 | .w_full() |
| 1564 | 1565 | .max_w(px(eq_card_w(f32::from(viewport.width), self.card_maximized))) |
| 1565 | 1566 | // And a cap the other way, for the same reason the width |
| 1566 | 1567 | // has one: the card is docked in a column now, and at the |
| 1567 | 1568 | // 360 px floor it is taller than that column -- its title |
| 1568 | 1569 | // ran off the top and its buttons off the bottom, with |
| 1569 | - // neither reachable. Capped here, scrolled below. | |
| 1570 | + // neither reachable. The card itself owns that scroll: | |
| 1571 | + // every child, including the below-fold line, is in its | |
| 1572 | + // wheel surface rather than a fixed sibling dead zone. | |
| 1570 | 1573 | .max_h(relative(1.)) |
| 1574 | + .overflow_y_scroll() | |
| 1575 | + .track_scroll(&self.eq_scroll) | |
| 1571 | 1576 | // Maximized also *claims* the room the cap above |
| 1572 | 1577 | // only allows: `flex_1()`/`max_h` on the graph below |
| 1573 | 1578 | // has nothing to grow into if the card itself still |
| @@ -1584,18 +1589,12 @@ impl Player { | ||
| 1584 | 1589 | .child( |
| 1585 | 1590 | div() |
| 1586 | 1591 | .id("eq-card-rows") |
| 1587 | - // Shrinkable below its content, which is what | |
| 1588 | - // makes the cap above a scroll rather than a | |
| 1589 | - // clip; the rows themselves keep their heights. | |
| 1590 | - .min_h(px(0.)) | |
| 1591 | - // Maximized: stretch to the room the card | |
| 1592 | - // above now claims, so the graph's own | |
| 1593 | - // `flex_1` (above) has the leftover space to | |
| 1594 | - // grow into instead of the card just hugging | |
| 1595 | - // its content and leaving none. | |
| 1592 | + // A non-maximized card exposes the body's full | |
| 1593 | + // natural height to its parent scroll surface; | |
| 1594 | + // maximized fills the claimed card room so the | |
| 1595 | + // graph can consume only the leftover height. | |
| 1596 | + .when(!graph_maximized, |d| d.flex_none()) | |
| 1596 | 1597 | .when(graph_maximized, |d| d.flex_1()) |
| 1597 | - .overflow_y_scroll() | |
| 1598 | - .track_scroll(&self.eq_scroll) | |
| 1599 | 1598 | .flex() |
| 1600 | 1599 | .flex_col() |
| 1601 | 1600 | .gap(px(2.)) |