Scope view
This commit is contained in:
@@ -84,12 +84,9 @@ fn app(cx: &Arc<Context>) -> View {
|
|||||||
scope.children.lock().unwrap().clear();
|
scope.children.lock().unwrap().clear();
|
||||||
|
|
||||||
for i in 0..count.get_dl() {
|
for i in 0..count.get_dl() {
|
||||||
scope.child(
|
scope.view(Arc::new(move |ctx| {
|
||||||
my_component,
|
ctx.draw_text(Point { x: 0, y: i }, &format!("{i}"));
|
||||||
Some(Arc::new(move |ctx, _| {
|
}));
|
||||||
ctx.draw_text(Point { x: 0, y: i }, &format!("{i}"));
|
|
||||||
})),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -190,4 +190,12 @@ impl Scope {
|
|||||||
|
|
||||||
self.children.lock().unwrap().push((ctx, view_wrapper));
|
self.children.lock().unwrap().push((ctx, view_wrapper));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn view(self: &Arc<Self>, view: View) {
|
||||||
|
let ctx = Context::new(move |_| view.clone());
|
||||||
|
|
||||||
|
ctx.refresh();
|
||||||
|
|
||||||
|
self.children.lock().unwrap().push((ctx, None));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user