Added a NoRenderRoot component for root only and NoRender doesn't render on child handlers

This commit is contained in:
2025-08-03 09:20:25 -05:00
parent 1aa78bc1a4
commit d59c3d7911
5 changed files with 32 additions and 10 deletions
+7 -2
View File
@@ -2,7 +2,7 @@ use std::sync::Arc;
use crate::{
widget::{Element, Widget},
NoRender,
NoRender, NoRenderRoot,
};
pub struct Div {
@@ -31,7 +31,12 @@ impl Element for Div {
scope.set_parent_size(transform.width, transform.height);
for elem in &self.children {
if elem.get::<NoRender>().is_some() {
continue;
}
scope.clear();
if let Some(style) = elem.get() {
scope.set_style(style);
}
@@ -57,7 +62,7 @@ impl Element for Div {
fn draw_child(&mut self, element: &Arc<Widget>) {
self.children.push(element.clone());
element.inject(|w| w.component(NoRender));
element.inject(|w| w.component(NoRenderRoot));
}
fn as_any(&self) -> &dyn std::any::Any {