From 3685670ff7e9d583643ac0bf77a63db1d0c7e286 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 18 Feb 2026 11:54:07 -0600 Subject: [PATCH] bugfix: fixing scrolling issues with the verse editors --- src/ui/song_editor.rs | 23 +++++++++++++++++------ src/ui/widgets/verse_editor.rs | 6 +++--- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/ui/song_editor.rs b/src/ui/song_editor.rs index a198ef1..eadf48d 100644 --- a/src/ui/song_editor.rs +++ b/src/ui/song_editor.rs @@ -22,12 +22,15 @@ use cosmic::{ iced_wgpu::graphics::text::cosmic_text::fontdb, iced_widget::{ column, row, - scrollable::{Direction, Scrollbar}, + scrollable::{ + self as iced_scrollable, AbsoluteOffset, Direction, + Scrollbar, + }, stack, }, theme, widget::{ - ColorPickerModel, RcElementWrapper, button, + ColorPickerModel, Id, RcElementWrapper, button, color_picker::ColorPickerUpdate, combo_box, container, divider, dnd_destination, dnd_source, dropdown, @@ -94,6 +97,7 @@ pub struct SongEditor { #[debug(skip)] stroke_color_model: ColorPickerModel, verses: Option>, + verses_scroll_id: Id, hovered_verse_chip: Option, hovered_dnd_verse_chip: Option, stroke_color_picker_open: bool, @@ -324,6 +328,7 @@ impl SongEditor { ), stroke_color_picker_open: false, verses: None, + verses_scroll_id: Id::unique(), editing_verse_order: false, hovered_dnd_verse_chip: None, hovered_verse_chip: None, @@ -635,10 +640,15 @@ impl SongEditor { verse_editor::Action::ScrollVerses( pixels, ) => { - // - // - // - (); + return Action::Task( + iced_scrollable::scroll_by( + self.verses_scroll_id.clone(), + AbsoluteOffset { + x: 0.0, + y: pixels, + }, + ), + ); } verse_editor::Action::UpdateVerseName( verse_name, @@ -1251,6 +1261,7 @@ impl SongEditor { .apply(container) .padding(Padding::default().right(space_l)), ) + .id(self.verses_scroll_id.clone()) .height(Length::Fill) .direction(Direction::Vertical(Scrollbar::new())); diff --git a/src/ui/widgets/verse_editor.rs b/src/ui/widgets/verse_editor.rs index 943a414..1d644af 100644 --- a/src/ui/widgets/verse_editor.rs +++ b/src/ui/widgets/verse_editor.rs @@ -56,7 +56,7 @@ impl VerseEditor { match message { Message::UpdateLyric(action) => match action { text_editor::Action::Edit(ref _edit) => { - self.content.perform(action.clone()); + self.content.perform(action); let lyrics = self.content.text(); self.lyric.clone_from(&lyrics); let verse = self.verse_name; @@ -64,14 +64,14 @@ impl VerseEditor { } text_editor::Action::Scroll { pixels } => { if self.content.line_count() > 6 { - self.content.perform(action.clone()); + self.content.perform(action); Action::None } else { Action::ScrollVerses(pixels) } } _ => { - self.content.perform(action.clone()); + self.content.perform(action); Action::None } },