From 776d19ae3e3690ce3fda37f3db55370590fc0c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 28 Nov 2026 02:05:12 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20style:=20spectrum=20back=20to=20?= =?UTF-8?q?one=20jagged=20line,=20now=20precise:=20each=20band=20draws=20a?= =?UTF-8?q?=20full=20up-and-down=20stroke=20to=20its=20level,=20so=20every?= =?UTF-8?q?=20band=20shows=20above=20and=20below=20the=20centre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/gui/parts.rs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/crates/client/src/gui/parts.rs b/crates/client/src/gui/parts.rs index ee5346e..ddbce1f 100644 --- a/crates/client/src/gui/parts.rs +++ b/crates/client/src/gui/parts.rs @@ -368,7 +368,7 @@ pub enum Voice { const STILL: f32 = 0.02; const EDGE: f32 = 16.; -const PEAK_SPACING: f32 = 3.; +const PEAK_SPACING: f32 = 5.; const MIN_PEAKS: usize = 6; pub fn voice_line(bands: Option<&VecDeque>, voice: Voice, t: Tokens) -> AnyElement { @@ -402,21 +402,16 @@ pub fn voice_line(bands: Option<&VecDeque>, voice: Voice, t: Tokens) -> Any if frayed { path = path.dash_array(&[px(4.), px(3.)]); } - let crest = |index: usize, side: f32| { - let along = (index as f32 + 0.5) / count; - let edge = (along.min(1. - along) * EDGE).min(1.); - let x = bounds.origin.x + bounds.size.width * along; - point(x, middle + px(side * peaks[index] * edge * half)) - }; path.move_to(point(bounds.origin.x, middle)); - for index in 0..peaks.len() { - path.line_to(crest(index, -1.)); + for (index, level) in peaks.iter().enumerate() { + for (quarter, side) in [(0.25, -1.), (0.75, 1.)] { + let along = (index as f32 + quarter) / count; + let edge = (along.min(1. - along) * EDGE).min(1.); + let x = bounds.origin.x + bounds.size.width * along; + path.line_to(point(x, middle + px(side * level * edge * half))); + } } path.line_to(point(bounds.origin.x + bounds.size.width, middle)); - for index in (0..peaks.len()).rev() { - path.line_to(crest(index, 1.)); - } - path.line_to(point(bounds.origin.x, middle)); if let Ok(path) = path.build() { window.paint_path(path, color); }