From ea397b7ed75104014eca7f58671fe2d6f3cab396 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Tue, 22 Oct 2024 23:19:37 +0300 Subject: [PATCH] add axis clamp --- crates/tek_core/src/space.rs | 6 ++++-- crates/tek_sequencer/src/sequencer.rs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/tek_core/src/space.rs b/crates/tek_core/src/space.rs index 57c93122..fa6477d7 100644 --- a/crates/tek_core/src/space.rs +++ b/crates/tek_core/src/space.rs @@ -23,7 +23,8 @@ macro_rules! impl_axis_common { ($A:ident $T:ty) => { pub struct FixedAxis { pub start: T, - pub point: Option + pub point: Option, + pub clamp: Option, } impl_axis_common!(FixedAxis u16); @@ -32,7 +33,8 @@ impl_axis_common!(FixedAxis usize); pub struct ScaledAxis { pub start: T, pub scale: T, - pub point: Option + pub point: Option, + pub clamp: Option, } impl_axis_common!(ScaledAxis u16); diff --git a/crates/tek_sequencer/src/sequencer.rs b/crates/tek_sequencer/src/sequencer.rs index dca6e3f4..8fc79126 100644 --- a/crates/tek_sequencer/src/sequencer.rs +++ b/crates/tek_sequencer/src/sequencer.rs @@ -229,8 +229,8 @@ impl PhraseEditor { notes_out: Arc::new(RwLock::new([false;128])), keys: keys_vert(), buffer: Default::default(), - note_axis: FixedAxis { start: 12, point: Some(36) }, - time_axis: ScaledAxis { start: 0, scale: 24, point: Some(0) }, + note_axis: FixedAxis { start: 12, point: Some(36), clamp: Some(127) }, + time_axis: ScaledAxis { start: 0, point: Some(0), clamp: Some(0), scale: 24 }, focused: false, entered: false, mode: false,