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 | notify_error, pop_in, | 24 | notify_error, pop_in, |
| 25 | settings_page::segmented, | 25 | settings_page::segmented, |
| 26 | text, | 26 | text, |
| 27 | - wave::wave, | 27 | + wave::wave_slot, |
| 28 | widget::{icon_button, spawn_warn}, | 28 | widget::{icon_button, spawn_warn}, |
| 29 | }; | 29 | }; |
| 30 | use crate::{ | 30 | use crate::{ |
| @@ -485,16 +485,9 @@ impl Yumush { | |||
| 485 | .bg(palette.panel) | 485 | .bg(palette.panel) |
| 486 | .occlude() | 486 | .occlude() |
| 487 | .text_size(text(12.)) | 487 | .text_size(text(12.)) |
| 488 | - .children( | 488 | + .children(audio.then(|| { |
| 489 | - audio | 489 | + wave_slot(self.chat.waves.share(viewer.user_id), 14., palette.alert) |
| 490 | - .then(|| { | 490 | + })) |
| 491 | - self.chat | ||
| 492 | - .waves | ||
| 493 | - .share(viewer.user_id) | ||
| 494 | - .map(|history| wave(history, 14., palette.alert)) | ||
| 495 | - }) | ||
| 496 | - .flatten(), | ||
| 497 | - ) | ||
| 498 | .children(audio.then(|| { | 491 | .children(audio.then(|| { |
| 499 | Icon::new(IconName::Volume2) | 492 | Icon::new(IconName::Volume2) |
| 500 | .w(px(14.)) | 493 | .w(px(14.)) |
crates/client/src/gui/sidebar.rsmodified+2 -7
| @@ -30,7 +30,7 @@ use super::{ | |||
| 30 | settings_page::{segment, segment_track}, | 30 | settings_page::{segment, segment_track}, |
| 31 | social::Relation, | 31 | social::Relation, |
| 32 | voice_stats, | 32 | voice_stats, |
| 33 | - wave::wave, | 33 | + wave::wave_slot, |
| 34 | widget::{bare_input, compact_frame, icon_button}, | 34 | widget::{bare_input, compact_frame, icon_button}, |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| @@ -288,12 +288,7 @@ impl Yumush { | |||
| 288 | .text_color(palette.alert), | 288 | .text_color(palette.alert), |
| 289 | ) | 289 | ) |
| 290 | }) | 290 | }) |
| 291 | - .children( | 291 | + .child(wave_slot(self.chat.waves.voice(user.id), 12., palette.ok)), |
| 292 | - self.chat | ||
| 293 | - .waves | ||
| 294 | - .voice(user.id) | ||
| 295 | - .map(|history| wave(history, 12., palette.ok)), | ||
| 296 | - ), | ||
| 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 | div() | 100 | div() |
| 94 | .flex() | 101 | .flex() |
| 95 | .items_center() | 102 | .items_center() |