Components will now render and set cursor

This commit is contained in:
veeso
2021-03-14 12:22:50 +01:00
parent 2e3dc7f7a5
commit 2b6f7e4868
12 changed files with 508 additions and 327 deletions

View File

@@ -24,7 +24,7 @@
*/
// imports
use super::{Component, InputEvent, Msg, Payload, Props, PropsBuilder, Render};
use super::{Canvas, Component, InputEvent, Msg, Payload, Props, PropsBuilder, Rect};
// ext
use std::collections::HashMap;
@@ -83,11 +83,11 @@ impl View {
/// ### render
///
/// Render component with the provided id
pub fn render(&self, id: &str) -> Option<Render> {
match self.components.get(id) {
None => None,
Some(component) => component.render(),
/// RenderData component with the provided id
#[cfg(not(tarpaulin_include))]
pub fn render(&self, id: &str, frame: &mut Canvas, area: Rect) {
if let Some(component) = self.components.get(id) {
component.render(frame, area);
}
}
@@ -258,6 +258,7 @@ mod tests {
assert!(view.components.get(text).is_none());
}
/*
#[test]
fn test_ui_layout_view_mount_render() {
let mut view: View = View::init();
@@ -267,6 +268,7 @@ mod tests {
assert!(view.render(input).is_some());
assert!(view.render("unexisting").is_none());
}
*/
#[test]
fn test_ui_layout_view_focus() {