Merge branch 'master' into fix-non-str-attributes

This commit is contained in:
Jonathan Kelley committed 2022-12-17 01:51:13 -08:00
commit cc7736302a
38 files changed
+890 -601

No files matched your search

+8 -6
View File
@@ -17,12 +17,14 @@ fn app(cx: Scope) -> Element {
width: "100%",
background_color: "hsl({hue}, 70%, {brightness}%)",
onmousemove: move |evt| {
if let RenderReturn::Sync(Ok(node))=cx.root_node(){
let node = tui_query.get(node.root_ids[0].get());
let Size{width, height} = node.size().unwrap();
let pos = evt.inner().element_coordinates();
hue.set((pos.x as f32/width as f32)*255.0);
brightness.set((pos.y as f32/height as f32)*100.0);
if let RenderReturn::Sync(Ok(node)) = cx.root_node() {
if let Some(id) = node.root_ids[0].get() {
let node = tui_query.get(id);
let Size{width, height} = node.size().unwrap();
let pos = evt.inner().element_coordinates();
hue.set((pos.x as f32/width as f32)*255.0);
brightness.set((pos.y as f32/height as f32)*100.0);
}
}
},
"hsl({hue}, 70%, {brightness}%)",
+1 -1
View File
@@ -11,7 +11,7 @@ pub use input::*;
pub(crate) fn get_root_id<T>(cx: Scope<T>) -> Option<ElementId> {
if let RenderReturn::Sync(Ok(sync)) = cx.root_node() {
sync.root_ids.get(0).map(|id| id.get())
sync.root_ids.get(0).and_then(|id| id.get())
} else {
None
}