forge
Explore
Log in

Don't you dare go Hollow

Voice and share waves keep a fixed slot so rows don't shift

Browse files at this commit

9e0576caca8d5f11fb9edd3edfbb27a4338b63c3Ahmet Kaan GümüşParent: f3c3e95
  • fix
    • voice and share waves keep a fixed slot so rows don't shift
Show full message
🐛 fix: voice and share waves keep a fixed slot so rows don't shift
crates/client/src/gui/share_view.rsmodified+4 -11
@@ -24,7 +24,7 @@ use super::{
2424 notify_error, pop_in,
2525 settings_page::segmented,
2626 text,
27- wave::wave,
27+ wave::wave_slot,
2828 widget::{icon_button, spawn_warn},
2929 };
3030 use crate::{
@@ -485,16 +485,9 @@ impl Yumush {
485485 .bg(palette.panel)
486486 .occlude()
487487 .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+ }))
498491 .children(audio.then(|| {
499492 Icon::new(IconName::Volume2)
500493 .w(px(14.))
crates/client/src/gui/sidebar.rsmodified+2 -7
@@ -30,7 +30,7 @@ use super::{
3030 settings_page::{segment, segment_track},
3131 social::Relation,
3232 voice_stats,
33- wave::wave,
33+ wave::wave_slot,
3434 widget::{bare_input, compact_frame, icon_button},
3535 };
3636
@@ -288,12 +288,7 @@ impl Yumush {
288288 .text_color(palette.alert),
289289 )
290290 })
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)),
297292 )
298293 }
299294
crates/client/src/gui/wave.rsmodified+8 -1
@@ -89,7 +89,14 @@ impl Waves {
8989 }
9090 }
9191
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 {
93100 div()
94101 .flex()
95102 .items_center()