1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use pax_lang::api::*;
use pax_lang::*;
use pax_std::primitives::{Ellipse, Frame, Group, Path, Rectangle, Text};
use pax_std::components::{Stacker};
use pax_std::types::{Color, StackerDirection};
#[derive(Pax)]
#[file("grids.pax")]
pub struct Grids {
pub ticks: Property<usize>,
pub rects: Property<Vec<RectDef>>,
}
impl Grids {
pub fn handle_did_mount(&mut self, ctx: RuntimeContext) {
// self.rects.set(vec![
// pax_struct!(
// RectDef {
// x: 200,
// y: 150,
// width: 100,
// height: 100,
// fill: Color::rgb(1.0.into(), 0.0.into(), 0.0.into()),
// }
// ),
// pax_struct!(
// RectDef {
// x: 500,
// y: 300,
// width: 250,
// height: 350,
// fill: Color::rgb(0.0.into(), 1.0.into(), 0.0.into()),
// }
// ),
// ]);
}
}
#[derive(Pax)]
#[custom(Imports)]
pub struct RectDef {
pub x: Property<usize>,
pub y: Property<usize>,
pub width: Property<usize>,
pub height: Property<usize>,
pub fill: Property<pax_std::types::Color>,
}