mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
enable interior mutability for time/note axis
this will allow to adapt the cursor position during render, always keeping it visible
This commit is contained in:
parent
03e2e20258
commit
dd21f73e9d
4 changed files with 83 additions and 60 deletions
|
|
@ -88,9 +88,9 @@ pub struct PhraseEditor<E: Engine> {
|
|||
/// The full piano roll is rendered to this buffer
|
||||
pub buffer: BigBuffer,
|
||||
/// Cursor/scroll/zoom in pitch axis
|
||||
pub note_axis: FixedAxis<usize>,
|
||||
pub note_axis: RwLock<FixedAxis<usize>>,
|
||||
/// Cursor/scroll/zoom in time axis
|
||||
pub time_axis: ScaledAxis<usize>,
|
||||
pub time_axis: RwLock<ScaledAxis<usize>>,
|
||||
/// Whether this widget is focused
|
||||
pub focused: bool,
|
||||
/// Whether note enter mode is enabled
|
||||
|
|
@ -235,14 +235,23 @@ impl<E: Engine> PhraseEditor<E> {
|
|||
notes_out: Arc::new(RwLock::new([false;128])),
|
||||
keys: keys_vert(),
|
||||
buffer: Default::default(),
|
||||
note_axis: FixedAxis { start: 12, point: Some(36), clamp: Some(127) },
|
||||
time_axis: ScaledAxis { start: 00, point: Some(00), clamp: Some(000), scale: 24 },
|
||||
focused: false,
|
||||
entered: false,
|
||||
mode: false,
|
||||
now: Arc::new(0.into()),
|
||||
width: 0.into(),
|
||||
height: 0.into(),
|
||||
note_axis: RwLock::new(FixedAxis {
|
||||
start: 12,
|
||||
point: Some(36),
|
||||
clamp: Some(127)
|
||||
}),
|
||||
time_axis: RwLock::new(ScaledAxis {
|
||||
start: 00,
|
||||
point: Some(00),
|
||||
clamp: Some(000),
|
||||
scale: 24
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue