mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +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
|
|
@ -1,5 +1,16 @@
|
|||
use crate::*;
|
||||
|
||||
pub struct FixedAxis<T> {
|
||||
pub start: T,
|
||||
pub point: Option<T>,
|
||||
pub clamp: Option<T>,
|
||||
}
|
||||
pub struct ScaledAxis<T> {
|
||||
pub start: T,
|
||||
pub scale: T,
|
||||
pub point: Option<T>,
|
||||
pub clamp: Option<T>,
|
||||
}
|
||||
macro_rules! impl_axis_common { ($A:ident $T:ty) => {
|
||||
impl $A<$T> {
|
||||
#[inline] pub fn start_inc (&mut self, n: $T) -> $T {
|
||||
|
|
@ -20,23 +31,8 @@ macro_rules! impl_axis_common { ($A:ident $T:ty) => {
|
|||
}
|
||||
}
|
||||
} }
|
||||
|
||||
pub struct FixedAxis<T> {
|
||||
pub start: T,
|
||||
pub point: Option<T>,
|
||||
pub clamp: Option<T>,
|
||||
}
|
||||
|
||||
impl_axis_common!(FixedAxis u16);
|
||||
impl_axis_common!(FixedAxis usize);
|
||||
|
||||
pub struct ScaledAxis<T> {
|
||||
pub start: T,
|
||||
pub scale: T,
|
||||
pub point: Option<T>,
|
||||
pub clamp: Option<T>,
|
||||
}
|
||||
|
||||
impl_axis_common!(ScaledAxis u16);
|
||||
impl_axis_common!(ScaledAxis usize);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue