mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
fix note cursor length and advancement
This commit is contained in:
parent
98fa0c4c4f
commit
35599c6cde
3 changed files with 17 additions and 14 deletions
|
|
@ -251,9 +251,7 @@ impl<E: Engine> Arrangement<E> {
|
|||
ArrangementFocus::Track(_) => self.track_width_inc(),
|
||||
ArrangementFocus::Scene(_) => self.scene_next(),
|
||||
ArrangementFocus::Clip(_, _) => self.phrase_next(),
|
||||
ArrangementFocus::Mix => if let ArrangementViewMode::Vertical(factor) = self.mode {
|
||||
self.mode = ArrangementViewMode::Vertical(factor + 1)
|
||||
}
|
||||
ArrangementFocus::Mix => self.zoom_in(),
|
||||
}
|
||||
}
|
||||
pub fn decrement (&mut self) {
|
||||
|
|
@ -261,16 +259,18 @@ impl<E: Engine> Arrangement<E> {
|
|||
ArrangementFocus::Track(_) => self.track_width_dec(),
|
||||
ArrangementFocus::Scene(_) => self.scene_prev(),
|
||||
ArrangementFocus::Clip(_, _) => self.phrase_prev(),
|
||||
ArrangementFocus::Mix => if let ArrangementViewMode::Vertical(factor) = self.mode {
|
||||
self.mode = ArrangementViewMode::Vertical(factor.saturating_sub(1))
|
||||
}
|
||||
ArrangementFocus::Mix => self.zoom_out(),
|
||||
}
|
||||
}
|
||||
pub fn zoom_in (&mut self) {
|
||||
todo!("zoom in")
|
||||
if let ArrangementViewMode::Vertical(factor) = self.mode {
|
||||
self.mode = ArrangementViewMode::Vertical(factor + 1)
|
||||
}
|
||||
}
|
||||
pub fn zoom_out (&mut self) {
|
||||
todo!("zoom in")
|
||||
if let ArrangementViewMode::Vertical(factor) = self.mode {
|
||||
self.mode = ArrangementViewMode::Vertical(factor.saturating_sub(1))
|
||||
}
|
||||
}
|
||||
pub fn is_first_row (&self) -> bool {
|
||||
let selected = self.selected;
|
||||
|
|
@ -380,7 +380,9 @@ impl<E: Engine> Arrangement<E> {
|
|||
pub fn track_prev (&mut self) {
|
||||
self.selected.track_prev()
|
||||
}
|
||||
pub fn track_add (&mut self, name: Option<&str>, color: Option<Color>) -> Usually<&mut ArrangementTrack<E>> {
|
||||
pub fn track_add (
|
||||
&mut self, name: Option<&str>, color: Option<Color>
|
||||
) -> Usually<&mut ArrangementTrack<E>> {
|
||||
self.tracks.push(name.map_or_else(
|
||||
|| ArrangementTrack::new(&self.track_default_name(), color),
|
||||
|name| ArrangementTrack::new(name, color),
|
||||
|
|
|
|||
|
|
@ -127,9 +127,7 @@ impl Handle<Tui> for PhraseEditor<Tui> {
|
|||
},
|
||||
key!(KeyCode::Char('a')) => if self.entered {
|
||||
self.put();
|
||||
self.time_axis.point = self.time_axis.point.map(|time|{
|
||||
time + self.note_len / self.time_axis.scale
|
||||
});
|
||||
self.time_axis.point = self.time_axis.point.map(|time|{time + self.note_len});
|
||||
},
|
||||
key!(KeyCode::Char('s')) => if self.entered {
|
||||
self.put();
|
||||
|
|
|
|||
|
|
@ -88,10 +88,13 @@ impl Content for PhraseEditor<Tui> {
|
|||
if *entered {
|
||||
let area = to.area();
|
||||
if let (Some(time), Some(note)) = (time_axis.point, note_axis.point) {
|
||||
let x = area.x() + (time / time_axis.scale) as u16;
|
||||
let x1 = area.x() + (time / time_axis.scale) as u16;
|
||||
let x2 = x1 + (self.note_len / time_axis.scale) as u16;
|
||||
let y = area.y() + 1 + note as u16 / 2;
|
||||
let c = if note % 2 == 0 { "▀" } else { "▄" };
|
||||
to.blit(&c, x, y, Some(Style::default().fg(color)));
|
||||
for x in x1..x2 {
|
||||
to.blit(&c, x, y, Some(Style::default().fg(color)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue