Voice and share waves keep a fixed slot so rows don't shift
Browse files at this commit9e0576caca8d5f11fb9edd3edfbb27a4338b63c3Parent: f3c3e95- fix
- voice and share waves keep a fixed slot so rows don't shift
3 changed files +14 -19
- crates/client/src/gui/share_view.rs +4 -11
- crates/client/src/gui/sidebar.rs +2 -7
- crates/client/src/gui/wave.rs +8 -1
crates/client/src/gui/share_view.rsmodified+4 -11
| @@ -24,7 +24,7 @@ use super::{ | ||
| 24 | 24 | notify_error, pop_in, |
| 25 | 25 | settings_page::segmented, |
| 26 | 26 | text, |
| 27 | - wave::wave, | |
| 27 | + wave::wave_slot, | |
| 28 | 28 | widget::{icon_button, spawn_warn}, |
| 29 | 29 | }; |
| 30 | 30 | use crate::{ |
| @@ -485,16 +485,9 @@ impl Yumush { | ||
| 485 | 485 | .bg(palette.panel) |
| 486 | 486 | .occlude() |
| 487 | 487 | .text_size(text(12.)) |
| 488 | - .children( | |
| 489 | - audio | |
| 490 | - .then(|| { | |
| 491 | - self.chat | |
| 492 | - .waves | |
| 493 | - .share(viewer.user_id) | |
| 494 | - .map(|history| wave(history, 14., palette.alert)) | |
| 495 | - }) | |
| 496 | - .flatten(), | |
| 497 | - ) | |
| 488 | + .children(audio.then(|| { | |
| 489 | + wave_slot(self.chat.waves.share(viewer.user_id), 14., palette.alert) | |
| 490 | + })) | |
| 498 | 491 | .children(audio.then(|| { |
| 499 | 492 | Icon::new(IconName::Volume2) |
| 500 | 493 | .w(px(14.)) |
crates/client/src/gui/sidebar.rsmodified+2 -7
| @@ -30,7 +30,7 @@ use super::{ | ||
| 30 | 30 | settings_page::{segment, segment_track}, |
| 31 | 31 | social::Relation, |
| 32 | 32 | voice_stats, |
| 33 | - wave::wave, | |
| 33 | + wave::wave_slot, | |
| 34 | 34 | widget::{bare_input, compact_frame, icon_button}, |
| 35 | 35 | }; |
| 36 | 36 | |
| @@ -288,12 +288,7 @@ impl Yumush { | ||
| 288 | 288 | .text_color(palette.alert), |
| 289 | 289 | ) |
| 290 | 290 | }) |
| 291 | - .children( | |
| 292 | - self.chat | |
| 293 | - .waves | |
| 294 | - .voice(user.id) | |
| 295 | - .map(|history| wave(history, 12., palette.ok)), | |
| 296 | - ), | |
| 291 | + .child(wave_slot(self.chat.waves.voice(user.id), 12., palette.ok)), | |
| 297 | 292 | ) |
| 298 | 293 | } |
| 299 | 294 |
crates/client/src/gui/wave.rsmodified+8 -1
| @@ -89,7 +89,14 @@ impl Waves { | ||
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | -pub fn wave(history: &VecDeque<f32>, size: f32, color: Hsla) -> Div { | |
| 92 | +pub fn wave_slot(history: Option<&VecDeque<f32>>, size: f32, color: Hsla) -> Div { | |
| 93 | + div() | |
| 94 | + .flex_shrink_0() | |
| 95 | + .w(px(spectrum::BANDS as f32 * (BAR_WIDTH + 1.))) | |
| 96 | + .children(history.map(|history| wave(history, size, color))) | |
| 97 | +} | |
| 98 | + | |
| 99 | +fn wave(history: &VecDeque<f32>, size: f32, color: Hsla) -> Div { | |
| 93 | 100 | div() |
| 94 | 101 | .flex() |
| 95 | 102 | .items_center() |