add axis clamp

This commit is contained in:
🪞👃🪞 2024-10-22 23:19:37 +03:00
parent 932e3a5427
commit ea397b7ed7
2 changed files with 6 additions and 4 deletions

View file

@ -23,7 +23,8 @@ macro_rules! impl_axis_common { ($A:ident $T:ty) => {
pub struct FixedAxis<T> { pub struct FixedAxis<T> {
pub start: T, pub start: T,
pub point: Option<T> pub point: Option<T>,
pub clamp: Option<T>,
} }
impl_axis_common!(FixedAxis u16); impl_axis_common!(FixedAxis u16);
@ -32,7 +33,8 @@ impl_axis_common!(FixedAxis usize);
pub struct ScaledAxis<T> { pub struct ScaledAxis<T> {
pub start: T, pub start: T,
pub scale: T, pub scale: T,
pub point: Option<T> pub point: Option<T>,
pub clamp: Option<T>,
} }
impl_axis_common!(ScaledAxis u16); impl_axis_common!(ScaledAxis u16);

View file

@ -229,8 +229,8 @@ impl<E: Engine> PhraseEditor<E> {
notes_out: Arc::new(RwLock::new([false;128])), notes_out: Arc::new(RwLock::new([false;128])),
keys: keys_vert(), keys: keys_vert(),
buffer: Default::default(), buffer: Default::default(),
note_axis: FixedAxis { start: 12, point: Some(36) }, note_axis: FixedAxis { start: 12, point: Some(36), clamp: Some(127) },
time_axis: ScaledAxis { start: 0, scale: 24, point: Some(0) }, time_axis: ScaledAxis { start: 0, point: Some(0), clamp: Some(0), scale: 24 },
focused: false, focused: false,
entered: false, entered: false,
mode: false, mode: false,