Run Iris examples on desktop and Android
This commit is contained in:
1 parent
37f956707e
commit
b5666cdef9
25 files changed
+577
-205
No files matched your search
@@ -0,0 +1,20 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
use app::*;
|
||||
|
||||
#[derive(AndroidUiState)]
|
||||
struct State {
|
||||
ui_state: AndroidUiState,
|
||||
}
|
||||
|
||||
impl AndroidAppState for State {
|
||||
type Resources = StdRsc<Self>;
|
||||
}
|
||||
|
||||
#[iris::app_init]
|
||||
fn create(mut ui_state: AndroidUiState, rsc: &mut StdRsc<State>) -> State {
|
||||
let _ = build(rsc, &mut ui_state);
|
||||
State { ui_state }
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
use iris::prelude::*;
|
||||
use winit::event::WindowEvent;
|
||||
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
use app::*;
|
||||
|
||||
const ROWS: usize = 1000;
|
||||
const SETTLE_FRAMES: usize = 4;
|
||||
const FRAMES: usize = 6;
|
||||
|
||||
@@ -14,30 +18,17 @@ struct State {
|
||||
|
||||
impl DesktopAppState for State {
|
||||
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
|
||||
let mut span = Span::empty(Dir::DOWN);
|
||||
for _ in 0..ROWS {
|
||||
let img = image::DynamicImage::new_rgba8(32, 32);
|
||||
let widget = image::<StdRsc<Self>>(img)(rsc);
|
||||
let widget = rsc.ui.widgets.add_strong(widget);
|
||||
span.push(widget.any());
|
||||
}
|
||||
let span = rsc.ui.widgets.add_strong(span);
|
||||
let span_weak = span.weak();
|
||||
let root = rsc
|
||||
.ui
|
||||
.widgets
|
||||
.add_strong(ScrollArea::new(span.any(), Axis::Y, Pin::End));
|
||||
ui_state.set_root(rsc, root.any());
|
||||
let span = build(rsc, &mut ui_state);
|
||||
Self {
|
||||
ui_state,
|
||||
span: span_weak,
|
||||
span,
|
||||
frame: 0,
|
||||
appended: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn window_event(&mut self, event: winit::event::WindowEvent, rsc: &mut StdRsc<Self>) {
|
||||
if !matches!(event, winit::event::WindowEvent::RedrawRequested) {
|
||||
fn window_event(&mut self, event: WindowEvent, rsc: &mut StdRsc<Self>) {
|
||||
if !matches!(event, WindowEvent::RedrawRequested) {
|
||||
return;
|
||||
}
|
||||
self.frame += 1;
|
||||
@@ -48,7 +39,7 @@ impl DesktopAppState for State {
|
||||
);
|
||||
if self.frame == SETTLE_FRAMES && !self.appended {
|
||||
self.appended = true;
|
||||
let img = image::DynamicImage::new_rgba8(32, 32);
|
||||
let img = iris::image::DynamicImage::new_rgba8(32, 32);
|
||||
let widget = image::<StdRsc<Self>>(img)(rsc);
|
||||
let widget = rsc.ui.widgets.add_strong(widget);
|
||||
rsc.ui
|
||||
@@ -0,0 +1,24 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
const ROWS: usize = 1000;
|
||||
|
||||
pub(crate) fn build<Rsc: UiRsc>(
|
||||
rsc: &mut Rsc,
|
||||
ui_state: &mut impl HasRoot<Rsc>,
|
||||
) -> WeakWidget<Span> {
|
||||
let mut span = Span::empty(Dir::DOWN);
|
||||
for _ in 0..ROWS {
|
||||
let img = iris::image::DynamicImage::new_rgba8(32, 32);
|
||||
let widget = image::<Rsc>(img)(rsc);
|
||||
let widget = rsc.ui_mut().widgets.add_strong(widget);
|
||||
span.push(widget.any());
|
||||
}
|
||||
let span = rsc.ui_mut().widgets.add_strong(span);
|
||||
let span_weak = span.weak();
|
||||
let root = rsc
|
||||
.ui_mut()
|
||||
.widgets
|
||||
.add_strong(ScrollArea::new(span.any(), Axis::Y, Pin::End));
|
||||
ui_state.set_root(rsc, root.any());
|
||||
span_weak
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
use app::*;
|
||||
|
||||
#[derive(AndroidUiState)]
|
||||
struct State {
|
||||
ui_state: AndroidUiState,
|
||||
}
|
||||
|
||||
impl AndroidAppState for State {
|
||||
type Resources = StdRsc<Self>;
|
||||
}
|
||||
|
||||
#[iris::app_init]
|
||||
fn create(mut ui_state: AndroidUiState, rsc: &mut StdRsc<State>) -> State {
|
||||
build(rsc, &mut ui_state);
|
||||
State { ui_state }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
use iris::prelude::*;
|
||||
use winit::{dpi::LogicalSize, window::WindowAttributes};
|
||||
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
use app::*;
|
||||
|
||||
#[derive(DesktopUiState)]
|
||||
struct State {
|
||||
ui_state: DesktopUiState,
|
||||
}
|
||||
|
||||
impl DesktopAppState for State {
|
||||
fn window_attributes() -> WindowAttributes {
|
||||
WindowAttributes::default().with_inner_size(LogicalSize::new(420.0, 900.0))
|
||||
}
|
||||
|
||||
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
|
||||
build(rsc, &mut ui_state);
|
||||
Self { ui_state }
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
DesktopApp::<State>::run();
|
||||
}
|
||||
@@ -1,14 +1,4 @@
|
||||
use iris::prelude::*;
|
||||
use winit::{dpi::LogicalSize, window::WindowAttributes};
|
||||
|
||||
fn main() {
|
||||
DesktopApp::<State>::run();
|
||||
}
|
||||
|
||||
#[derive(DesktopUiState)]
|
||||
struct State {
|
||||
ui_state: DesktopUiState,
|
||||
}
|
||||
|
||||
const ROWS: usize = 800;
|
||||
const IMAGE_EVERY: usize = 12;
|
||||
@@ -20,9 +10,9 @@ fn row_text(i: usize) -> String {
|
||||
format!("Message {i}: {}", SENTENCE.repeat(repeats))
|
||||
}
|
||||
|
||||
fn row_image(i: usize) -> image::DynamicImage {
|
||||
fn row_image(i: usize) -> iris::image::DynamicImage {
|
||||
let hue = ((i * 47) % 255) as u8;
|
||||
image::RgbaImage::from_pixel(48, 48, image::Rgba([hue, 128, 255 - hue, 255])).into()
|
||||
iris::image::RgbaImage::from_pixel(48, 48, iris::image::Rgba([hue, 128, 255 - hue, 255])).into()
|
||||
}
|
||||
|
||||
fn build_row<Rsc: UiRsc + 'static>(rsc: &mut Rsc, i: usize) -> StrongWidget {
|
||||
@@ -58,25 +48,17 @@ fn build_row<Rsc: UiRsc + 'static>(rsc: &mut Rsc, i: usize) -> StrongWidget {
|
||||
}
|
||||
}
|
||||
|
||||
impl DesktopAppState for State {
|
||||
fn window_attributes() -> WindowAttributes {
|
||||
WindowAttributes::default().with_inner_size(LogicalSize::new(420.0, 900.0))
|
||||
pub(crate) fn build<Rsc: HasEvents>(rsc: &mut Rsc, ui_state: &mut impl HasRoot<Rsc>) {
|
||||
let mut list = LazySpan::new(Dir::DOWN, Pin::End);
|
||||
for i in 0..ROWS {
|
||||
let row = build_row(rsc, i);
|
||||
list.push_back(LazyItem::new(i as u64, row));
|
||||
}
|
||||
|
||||
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
|
||||
let mut list = LazySpan::new(Dir::DOWN, Pin::End);
|
||||
for i in 0..ROWS {
|
||||
let row = build_row(rsc, i);
|
||||
list.push_back(LazyItem::new(i as u64, row));
|
||||
}
|
||||
|
||||
let root = list
|
||||
.scrollable()
|
||||
.masked()
|
||||
.background(rect(PaintId::WHITE))
|
||||
.add_strong(rsc);
|
||||
ui_state.set_root(rsc, root.any());
|
||||
|
||||
Self { ui_state }
|
||||
}
|
||||
let root = list
|
||||
.scrollable()
|
||||
.masked()
|
||||
.background(rect(PaintId::WHITE))
|
||||
.add_strong(rsc);
|
||||
ui_state.set_root(rsc, root.any());
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
use app::*;
|
||||
|
||||
#[derive(AndroidUiState)]
|
||||
struct State {
|
||||
ui_state: AndroidUiState,
|
||||
}
|
||||
|
||||
impl AndroidAppState for State {
|
||||
type Resources = StdRsc<Self>;
|
||||
}
|
||||
|
||||
#[iris::app_init]
|
||||
fn create(mut ui_state: AndroidUiState, rsc: &mut StdRsc<State>) -> State {
|
||||
build(rsc, &mut ui_state);
|
||||
State { ui_state }
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
fn main() {
|
||||
DesktopApp::<State>::run();
|
||||
}
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
use app::*;
|
||||
|
||||
#[derive(DesktopUiState)]
|
||||
struct State {
|
||||
@@ -11,7 +11,11 @@ struct State {
|
||||
|
||||
impl DesktopAppState for State {
|
||||
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
|
||||
rect(PaintId::RED).set_root(rsc, &mut ui_state);
|
||||
build(rsc, &mut ui_state);
|
||||
Self { ui_state }
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
DesktopApp::<State>::run();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
pub(crate) fn build<Rsc: UiRsc>(rsc: &mut Rsc, ui_state: &mut impl HasRoot<Rsc>) {
|
||||
rect(PaintId::RED).set_root(rsc, ui_state);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
use app::*;
|
||||
|
||||
#[derive(AndroidUiState)]
|
||||
struct Client {
|
||||
ui_state: AndroidUiState,
|
||||
info: WeakWidget<Text>,
|
||||
}
|
||||
|
||||
impl AndroidAppState for Client {
|
||||
type Resources = StdRsc<Self>;
|
||||
|
||||
fn on_insets_changed(&mut self, rsc: &mut Self::Resources, _: WindowInsets) {
|
||||
let views = self
|
||||
.ui_state
|
||||
.renderer
|
||||
.as_ref()
|
||||
.map_or(0, |renderer| renderer.ui.view_count());
|
||||
update_info(rsc, self.info, views);
|
||||
}
|
||||
}
|
||||
|
||||
#[iris::app_init]
|
||||
fn create(mut ui_state: AndroidUiState, rsc: &mut StdRsc<Client>) -> Client {
|
||||
let widgets = build(rsc, &mut ui_state);
|
||||
update_info(rsc, widgets.info, 0);
|
||||
Client {
|
||||
ui_state,
|
||||
info: widgets.info,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
use iris::prelude::*;
|
||||
use winit::event::WindowEvent;
|
||||
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
use app::*;
|
||||
|
||||
#[derive(DesktopUiState)]
|
||||
struct Client {
|
||||
ui_state: DesktopUiState,
|
||||
info: WeakWidget<Text>,
|
||||
}
|
||||
|
||||
impl DesktopAppState for Client {
|
||||
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
|
||||
let widgets = build(rsc, &mut ui_state);
|
||||
update_info(rsc, widgets.info, 0);
|
||||
Self {
|
||||
ui_state,
|
||||
info: widgets.info,
|
||||
}
|
||||
}
|
||||
|
||||
fn window_event(&mut self, _: WindowEvent, rsc: &mut StdRsc<Self>) {
|
||||
update_info(rsc, self.info, self.ui_state.renderer.ui.view_count());
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
DesktopApp::<Client>::run();
|
||||
}
|
||||
@@ -1,45 +1,26 @@
|
||||
use iris::prelude::*;
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
use winit::event::WindowEvent;
|
||||
|
||||
fn main() {
|
||||
DesktopApp::<Client>::run();
|
||||
}
|
||||
|
||||
#[derive(DesktopUiState)]
|
||||
struct Client {
|
||||
ui_state: DesktopUiState,
|
||||
info: WeakWidget<Text>,
|
||||
}
|
||||
|
||||
impl DesktopAppState for Client {
|
||||
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
|
||||
let widgets = build(rsc, &mut ui_state);
|
||||
Self {
|
||||
ui_state,
|
||||
info: widgets.info,
|
||||
}
|
||||
}
|
||||
|
||||
fn window_event(&mut self, _: WindowEvent, rsc: &mut StdRsc<Self>) {
|
||||
let render_state = rsc.ui.render_state();
|
||||
let new = format!(
|
||||
"widgets: {}\nactive: {}\nviews: {}",
|
||||
rsc.widgets().len(),
|
||||
render_state.get().active_widgets(),
|
||||
self.ui_state.renderer.ui.view_count(),
|
||||
);
|
||||
if new != *rsc.widgets()[self.info].content {
|
||||
*rsc.widgets_mut()[self.info].content = new;
|
||||
}
|
||||
pub(crate) fn update_info<Rsc: UiRsc>(rsc: &mut Rsc, info: WeakWidget<Text>, views: usize) {
|
||||
let render_state = rsc.ui().render_state();
|
||||
let new = format!(
|
||||
"widgets: {}\nactive: {}\nviews: {views}",
|
||||
rsc.widgets().len(),
|
||||
render_state.get().active_widgets(),
|
||||
);
|
||||
if new != *rsc.widgets()[info].content {
|
||||
*rsc.widgets_mut()[info].content = new;
|
||||
}
|
||||
}
|
||||
|
||||
struct ClientWidgets {
|
||||
info: WeakWidget<Text>,
|
||||
pub(crate) struct ClientWidgets {
|
||||
pub(crate) info: WeakWidget<Text>,
|
||||
}
|
||||
|
||||
fn build<Rsc: HasEvents>(rsc: &mut Rsc, ui_state: &mut impl HasRoot<Rsc>) -> ClientWidgets
|
||||
pub(crate) fn build<Rsc: HasEvents>(
|
||||
rsc: &mut Rsc,
|
||||
ui_state: &mut impl HasRoot<Rsc>,
|
||||
) -> ClientWidgets
|
||||
where
|
||||
Rsc::State: FocusHost,
|
||||
{
|
||||
@@ -1,30 +0,0 @@
|
||||
use iris::prelude::*;
|
||||
use std::time::Duration;
|
||||
|
||||
fn main() {
|
||||
DesktopApp::<State>::run();
|
||||
}
|
||||
|
||||
#[derive(DesktopUiState)]
|
||||
struct State {
|
||||
ui_state: DesktopUiState,
|
||||
}
|
||||
|
||||
impl DesktopAppState for State {
|
||||
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
|
||||
let rect = rect(PaintId::RED).add(rsc);
|
||||
rect.task_on(CursorSense::click(), async move |mut ctx| {
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
ctx.update(move |_, rsc| {
|
||||
let rect = rect(rsc);
|
||||
if rect.is_paint(&PaintId::RED) {
|
||||
rect.set_paint(PaintId::BLUE);
|
||||
} else {
|
||||
rect.set_paint(PaintId::RED);
|
||||
}
|
||||
});
|
||||
})
|
||||
.set_root(rsc, &mut ui_state);
|
||||
Self { ui_state }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
use app::*;
|
||||
|
||||
#[derive(AndroidUiState)]
|
||||
struct State {
|
||||
ui_state: AndroidUiState,
|
||||
}
|
||||
|
||||
impl AndroidAppState for State {
|
||||
type Resources = StdRsc<Self>;
|
||||
}
|
||||
|
||||
#[iris::app_init]
|
||||
fn create(mut ui_state: AndroidUiState, rsc: &mut StdRsc<State>) -> State {
|
||||
build(rsc, &mut ui_state);
|
||||
State { ui_state }
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
use app::*;
|
||||
|
||||
#[derive(DesktopUiState)]
|
||||
struct State {
|
||||
ui_state: DesktopUiState,
|
||||
}
|
||||
|
||||
impl DesktopAppState for State {
|
||||
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
|
||||
build(rsc, &mut ui_state);
|
||||
Self { ui_state }
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
DesktopApp::<State>::run();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
use iris::prelude::*;
|
||||
use std::time::Duration;
|
||||
|
||||
pub(crate) fn build<Rsc: HasEvents + HasTasks>(rsc: &mut Rsc, ui_state: &mut impl HasRoot<Rsc>)
|
||||
where
|
||||
Rsc::State: FocusHost,
|
||||
{
|
||||
let rect = rect(PaintId::RED).add(rsc);
|
||||
rect.task_on(CursorSense::click(), async move |mut ctx| {
|
||||
iris::task::sleep(Duration::from_secs(1)).await;
|
||||
ctx.update(move |_, rsc| {
|
||||
let rect = rect(rsc);
|
||||
if rect.is_paint(&PaintId::RED) {
|
||||
rect.set_paint(PaintId::BLUE);
|
||||
} else {
|
||||
rect.set_paint(PaintId::RED);
|
||||
}
|
||||
});
|
||||
})
|
||||
.set_root(rsc, ui_state);
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
fn main() {
|
||||
DesktopApp::<State>::run();
|
||||
}
|
||||
|
||||
#[derive(DesktopUiState)]
|
||||
struct State {
|
||||
ui_state: DesktopUiState,
|
||||
}
|
||||
|
||||
type Rsc = StdRsc<State>;
|
||||
|
||||
#[derive(Clone, Copy, WidgetView)]
|
||||
struct Test {
|
||||
#[root]
|
||||
root: WeakWidget<Rect>,
|
||||
cur: WeakState<bool>,
|
||||
}
|
||||
|
||||
impl Test {
|
||||
pub fn new(rsc: &mut Rsc) -> Self {
|
||||
let root = rect(PaintId::RED).add(rsc);
|
||||
let cur = rsc.create_state(root, false);
|
||||
Self { root, cur }
|
||||
}
|
||||
pub fn toggle(&self, rsc: &mut Rsc) {
|
||||
let cur = &mut rsc[self.cur];
|
||||
*cur = !*cur;
|
||||
if *cur {
|
||||
rsc[self.root].set_paint(PaintId::BLUE);
|
||||
} else {
|
||||
rsc[self.root].set_paint(PaintId::RED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DesktopAppState for State {
|
||||
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
|
||||
let test = Test::new(rsc);
|
||||
|
||||
test.on(CursorSense::click(), move |_, rsc| {
|
||||
test.toggle(rsc);
|
||||
})
|
||||
.set_root(rsc, &mut ui_state);
|
||||
|
||||
Self { ui_state }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
use app::*;
|
||||
|
||||
#[derive(AndroidUiState)]
|
||||
struct State {
|
||||
ui_state: AndroidUiState,
|
||||
}
|
||||
|
||||
impl AndroidAppState for State {
|
||||
type Resources = StdRsc<Self>;
|
||||
}
|
||||
|
||||
#[iris::app_init]
|
||||
fn create(mut ui_state: AndroidUiState, rsc: &mut StdRsc<State>) -> State {
|
||||
build(rsc, &mut ui_state);
|
||||
State { ui_state }
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
use app::*;
|
||||
|
||||
#[derive(DesktopUiState)]
|
||||
struct State {
|
||||
ui_state: DesktopUiState,
|
||||
}
|
||||
|
||||
impl DesktopAppState for State {
|
||||
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
|
||||
build(rsc, &mut ui_state);
|
||||
Self { ui_state }
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
DesktopApp::<State>::run();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
#[derive(Clone, Copy, WidgetView)]
|
||||
struct Test {
|
||||
#[root]
|
||||
root: WeakWidget<Rect>,
|
||||
cur: WeakState<bool>,
|
||||
}
|
||||
|
||||
impl Test {
|
||||
pub fn new<State>(rsc: &mut StdRsc<State>) -> Self {
|
||||
let root = rect(PaintId::RED).add(rsc);
|
||||
let cur = rsc.create_state(root, false);
|
||||
Self { root, cur }
|
||||
}
|
||||
pub fn toggle<State>(&self, rsc: &mut StdRsc<State>) {
|
||||
let cur = &mut rsc[self.cur];
|
||||
*cur = !*cur;
|
||||
if *cur {
|
||||
rsc[self.root].set_paint(PaintId::BLUE);
|
||||
} else {
|
||||
rsc[self.root].set_paint(PaintId::RED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn build<State>(rsc: &mut StdRsc<State>, ui_state: &mut impl HasRoot<StdRsc<State>>)
|
||||
where
|
||||
State: FocusHost,
|
||||
{
|
||||
let test = Test::new(rsc);
|
||||
test.on(CursorSense::click(), move |_, rsc| {
|
||||
test.toggle(rsc);
|
||||
})
|
||||
.set_root(rsc, ui_state);
|
||||
}
|
||||
Reference in new issue
Block a user