Draft Program interactivity for Canvas
This commit is contained in:
parent
90c3a183d5
commit
0b5028b1ab
9 changed files with 112 additions and 36 deletions
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{
|
||||
canvas::{Drawable, Frame, Layer},
|
||||
canvas::{Drawable, Frame, Layer, Program},
|
||||
Primitive,
|
||||
};
|
||||
|
||||
|
|
@ -79,6 +79,20 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> Program for Cache<T>
|
||||
where
|
||||
T: Drawable + std::fmt::Debug,
|
||||
{
|
||||
type Input = T;
|
||||
|
||||
fn layers<'a>(
|
||||
&'a self,
|
||||
input: &'a Self::Input,
|
||||
) -> Vec<Box<dyn Layer + 'a>> {
|
||||
vec![Box::new(self.with(input))]
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Bind<'a, T: Drawable> {
|
||||
cache: &'a Cache<T>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue