call autoscroll before render instead of on move

This commit is contained in:
🪞👃🪞 2024-12-21 15:34:23 +01:00
parent a2a6ea1260
commit c1da3fac13

View file

@ -90,11 +90,9 @@ impl Command<PhraseEditorModel> for PhraseCommand {
SetNoteLength(x) => { state.set_note_len(x); },
SetTimeCursor(x) => {
state.set_time_point(x);
state.autoscroll();
},
SetNoteCursor(note) => {
state.set_note_point(note.min(127));
state.autoscroll();
},
_ => todo!("{:?}", self)
}
@ -118,7 +116,10 @@ impl Default for PhraseEditorModel {
}
has_size!(<Tui>|self:PhraseEditorModel|&self.size);
render!(<Tui>|self: PhraseEditorModel|&self.mode);
render!(<Tui>|self: PhraseEditorModel|{
self.autoscroll();
&self.mode
});
//render!(<Tui>|self: PhraseEditorModel|lay!(|add|{add(&self.size)?;add(self.mode)}));//bollocks
pub trait PhraseViewMode: Render<Tui> + HasSize<Tui> + MidiRange + MidiPoint + Debug + Send + Sync {