Replace the home header with the banner and the ring (#84)
CI / core (pull_request) Successful in 1m32s
CI / core (pull_request) Successful in 1m32s
The banner shows the ring, a cached view with one tick per champion of the Challenge in a fixed order, the Season, the « N / total champions validés » title, the last Completed champion and the last Match, over the splash of the last Completed champion, faded into the band. In a narrow window the ring goes above the text and the splash covers the banner. Hovering a card lights its tick. The banner reads its splash through its own cache: two at most, the one replaced given back from the GPU atlas too, none while « Statistiques » is shown or without an illustration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WYQB8paBcLk67XoAUYARBK
This commit is contained in:
1 parent
e28aefc3bc
commit
d256dd61d2
9 files changed
+1397
-102
No files matched your search
@@ -84,6 +84,10 @@ pub fn row_height(window_width: Pixels) -> Pixels {
|
||||
px(Metrics::of(window_width).row_height())
|
||||
}
|
||||
|
||||
/// The card under the pointer changed: its id, or none.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub struct CardHovered(pub Option<u32>);
|
||||
|
||||
/// What makes one card reachable with the keyboard: its handle, and the subscriptions that draw
|
||||
/// the grid again when the focus comes or goes (a cached view is not drawn by the focus alone).
|
||||
struct CardFocus {
|
||||
@@ -118,6 +122,8 @@ pub struct CardGrid {
|
||||
pub(crate) set_cards_calls: usize,
|
||||
}
|
||||
|
||||
impl EventEmitter<CardHovered> for CardGrid {}
|
||||
|
||||
impl CardGrid {
|
||||
pub fn new() -> CardGrid {
|
||||
CardGrid {
|
||||
@@ -189,6 +195,7 @@ impl CardGrid {
|
||||
};
|
||||
if next != self.hovered {
|
||||
self.hovered = next;
|
||||
cx.emit(CardHovered(next));
|
||||
cx.notify();
|
||||
}
|
||||
}
|
||||
@@ -227,6 +234,10 @@ impl CardGrid {
|
||||
/// The grid is not shown any more: its portraits are given back, in memory and in the
|
||||
/// window's atlas, and load again when it is drawn.
|
||||
pub fn release_images(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||
// Nor is any of its cards under the pointer: the ring's tick goes out.
|
||||
if self.hovered.take().is_some() {
|
||||
cx.emit(CardHovered(None));
|
||||
}
|
||||
let released = self
|
||||
.images
|
||||
.as_ref()
|
||||
@@ -334,6 +345,7 @@ impl CardGrid {
|
||||
// sheet of the card that was under it would stay. The next mouse move hovers again.
|
||||
.on_scroll(cx.listener(|grid, _: &ScrollEvent, _, cx| {
|
||||
if grid.hovered.take().is_some() {
|
||||
cx.emit(CardHovered(None));
|
||||
cx.notify();
|
||||
}
|
||||
}))
|
||||
|
||||
Reference in new issue
Block a user