diff --git a/playground/Cargo.toml b/playground/Cargo.toml index a2c2ffab..4d23f05d 100644 --- a/playground/Cargo.toml +++ b/playground/Cargo.toml @@ -4,6 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] +# vizia = {path = "../../vizia"} vizia = {git = "https://github.com/vizia/vizia"} morphorm-ecs = {path = "../ecs"} morphorm = {path = ".."} diff --git a/playground/src/canvas.rs b/playground/src/canvas.rs index b87762a3..ae45a61d 100644 --- a/playground/src/canvas.rs +++ b/playground/src/canvas.rs @@ -25,7 +25,7 @@ impl View for CanvasView { fn event(&mut self, cx: &mut EventContext, event: &mut Event) { event.map(|window_event, _| match window_event { WindowEvent::GeometryChanged(geo) => { - if geo.contains(GeometryChanged::WIDTH_CHANGED) || geo.contains(GeometryChanged::HEIGHT_CHANGED) { + if geo.contains(GeoChanged::WIDTH_CHANGED) || geo.contains(GeoChanged::HEIGHT_CHANGED) { cx.emit(AppEvent::SetCanvasSize( cx.cache.get_width(cx.current()) - 100.0, cx.cache.get_height(cx.current()) - 100.0, @@ -43,11 +43,11 @@ impl View for CanvasView { &app_data.world.cache, posx, posy, - cx.mouse.cursorx, - cx.mouse.cursory, + cx.mouse().cursorx, + cx.mouse().cursory, ); // println!("selected: {:?}", selected); - if cx.modifiers.contains(Modifiers::SHIFT) { + if cx.modifiers().contains(Modifiers::SHIFT) { if let Some(selected) = selected { cx.emit(AppEvent::MultiSelectNode(*selected)); } @@ -67,8 +67,8 @@ impl View for CanvasView { let mut path = vg::Path::new(); path.rect(bounds.x, bounds.y, bounds.w, bounds.h); - let background_color = cx.background_color().copied().unwrap_or_default(); - canvas.fill_path(&mut path, &vg::Paint::color(background_color.into())); + let background_color = cx.background_color(); + canvas.fill_path(&path, &vg::Paint::color(background_color.into())); draw_node( &app_data.root_node, @@ -145,14 +145,14 @@ fn draw_node>( let mut path = vg::Path::new(); path.rect(parent_pos.0 + posx, parent_pos.1 + posy, width, height); let paint = vg::Paint::color(vg::Color::rgb(*red, *green, *blue)); - canvas.fill_path(&mut path, &paint); + canvas.fill_path(&path, &paint); if let Some(selected_nodes) = selected_nodes { for selected_node in selected_nodes { if node.key() == selected_node.key() { let mut selection_paint = vg::Paint::color(vg::Color::rgb(72, 113, 174)); selection_paint.set_line_width(4.0); - canvas.stroke_path(&mut path, &selection_paint); + canvas.stroke_path(&path, &selection_paint); } } } diff --git a/playground/src/icons.rs b/playground/src/icons.rs deleted file mode 100644 index 739144f4..00000000 --- a/playground/src/icons.rs +++ /dev/null @@ -1,39 +0,0 @@ -#![allow(dead_code)] - -pub const ICON_EYE: &str = "\u{ea9a}"; -pub const ICON_EYE_CLOSED: &str = "\u{f7ec}"; -pub const ICON_ARROW_BAR_RIGHT: &str = "\u{ea0f}"; -pub const ICON_ARROW_BAR_LEFT: &str = "\u{ea0e}"; -pub const ICON_ARROW_BAR_DOWN: &str = "\u{ea0d}"; -pub const ICON_ARROW_BAR_UP: &str = "\u{ea10}"; -pub const ICON_LINK: &str = "\u{eade}"; -pub const ICON_UNLINK: &str = "\u{eb46}"; -pub const ICON_ARROW_AUTOFIT_WIDTH: &str = "\u{ef37}"; -pub const ICON_ARROW_AUTOFIT_HEIGHT: &str = "\u{ef33}"; -pub const ICON_TRANSITION_LEFT: &str = "\u{f2b3}"; -pub const ICON_LAYOUT_ALIGN_LEFT: &str = "\u{eacf}"; -pub const ICON_LAYOUT_ALIGN_RIGHT: &str = "\u{ead1}"; -pub const ICON_LAYOUT_ALIGN_BOTTOM: &str = "\u{eacd}"; -pub const ICON_LAYOUT_ALIGN_TOP: &str = "\u{ead2}"; -pub const ICON_LAYOUT_DISTRIBUTE_HORIZONTAL: &str = "\u{ead5}"; -pub const ICON_LAYOUT_DISTRIBUTE_VERTICAL: &str = "\u{ead6}"; -pub const ICON_BOX_ALIGN_BOTTOM_LEFT: &str = "\u{f2ce}"; -pub const ICON_BOX_ALIGN_BOTTOM_RIGHT: &str = "\u{f2cf}"; -pub const ICON_BOX_ALIGN_BOTTOM: &str = "\u{f2a8}"; -pub const ICON_BOX_ALIGN_LEFT: &str = "\u{f2a9}"; -pub const ICON_BOX_ALIGN_RIGHT: &str = "\u{f2aa}"; -pub const ICON_BOX_ALIGN_TOP_LEFT: &str = "\u{f2d0}"; -pub const ICON_BOX_ALIGN_TOP_RIGHT: &str = "\u{f2d1}"; -pub const ICON_BOX_ALIGN_TOP: &str = "\u{f2ab}"; -pub const ICON_PADDING: &str = "\u{ee18}"; -pub const ICON_DIMENSIONS: &str = "\u{ee7b}"; -pub const ICON_BOX_MARGIN: &str = "\u{ee0b}"; -pub const ICON_SQUARE_PLUS: &str = "\u{eb2a}"; -pub const ICON_ROW_INSERT_BOTTOM: &str = "\u{eed0}"; -pub const ICON_ROW_INSERT_TOP: &str = "\u{eed1}"; -pub const ICON_TRASH: &str = "\u{eb41}"; -pub const ICON_LOCK: &str = "\u{eae2}"; -pub const ICON_LOCK_OPEN: &str = "\u{eae1}"; -pub const ICON_CHEVRON_RIGHT: &str = "\u{ea61}"; -pub const ICON_CHEVRON_DOWN: &str = "\u{ea5f}"; -pub const ICON_LAYOUT_LIST: &str = "\u{ec14}"; diff --git a/playground/src/main.rs b/playground/src/main.rs index 95883746..5dd2831a 100644 --- a/playground/src/main.rs +++ b/playground/src/main.rs @@ -13,8 +13,6 @@ use canvas::*; mod properties; use properties::*; -mod icons; - pub enum AppEvent { Relayout, SetCanvasSize(f32, f32), @@ -43,8 +41,8 @@ pub enum AppEvent { AlignBottom, FillHeight, - SetLayoutType(&'static str), - SetPositionType(&'static str), + SetLayoutType(usize), + SetPositionType(usize), SetChildLeft(morph::Units), SetColBetween(morph::Units), @@ -92,11 +90,11 @@ pub struct AppData { height: morph::Units, bottom: morph::Units, - layout_type: morph::LayoutType, + selected_layout_type: usize, layout_type_list: Vec<&'static str>, - position_type: morph::PositionType, position_type_list: Vec<&'static str>, + selected_position_type: usize, child_left: morph::Units, col_between: morph::Units, @@ -156,11 +154,11 @@ impl AppData { height: morph::Units::Pixels(600.0), bottom: morph::Units::Auto, - layout_type: morph::LayoutType::Column, + selected_layout_type: 0, layout_type_list: vec!["Row", "Column"], - position_type: morph::PositionType::ParentDirected, position_type_list: vec!["Parent Directed", "Self Directed"], + selected_position_type: 0, child_left: morph::Units::Stretch(1.0), col_between: morph::Units::Stretch(1.0), @@ -194,8 +192,14 @@ impl AppData { self.col_between = self.world.store.col_between.get(node).copied().unwrap_or_default(); self.row_between = self.world.store.row_between.get(node).copied().unwrap_or_default(); - self.layout_type = self.world.store.layout_type.get(node).copied().unwrap_or_default(); - self.position_type = self.world.store.position_type.get(node).copied().unwrap_or_default(); + self.selected_layout_type = match self.world.store.layout_type.get(node).copied().unwrap_or_default() { + morph::LayoutType::Column => 0, + morph::LayoutType::Row => 1, + }; + self.selected_position_type = match self.world.store.position_type.get(node).copied().unwrap_or_default() { + morph::PositionType::ParentDirected => 0, + morph::PositionType::SelfDirected => 1, + }; self.min_left = self.world.store.min_left.get(node).copied().unwrap_or_default(); self.min_width = self.world.store.min_width.get(node).copied().unwrap_or_default(); @@ -381,29 +385,29 @@ impl Model for AppData { } } - AppEvent::SetLayoutType(layout_type) => { + AppEvent::SetLayoutType(selected_layout_type) => { if let Some(nodes) = &self.selected_nodes { for selected in nodes { - let layout_type = match *layout_type { - "Row" => morph::LayoutType::Row, + let layout_type = match *selected_layout_type { + 0 => morph::LayoutType::Row, _ => morph::LayoutType::Column, }; self.world.set_layout_type(*selected, layout_type); - self.layout_type = layout_type; + self.selected_layout_type = *selected_layout_type; } cx.emit(AppEvent::Relayout); } } - AppEvent::SetPositionType(position_type) => { + AppEvent::SetPositionType(selected_position_type) => { if let Some(nodes) = &self.selected_nodes { for selected in nodes { - let position_type = match *position_type { - "Parent Directed" => morph::PositionType::ParentDirected, + let position_type = match *selected_position_type { + 0 => morph::PositionType::ParentDirected, _ => morph::PositionType::SelfDirected, }; self.world.set_position_type(*selected, position_type); - self.position_type = position_type; + self.selected_position_type = *selected_position_type; } cx.emit(AppEvent::Relayout); } @@ -706,8 +710,10 @@ impl Model for AppData { fn main() { Application::new(|cx| { - cx.add_stylesheet("playground/src/theme.css").expect("Failed to find stylesheet"); - cx.add_fonts_mem(&[include_bytes!("tabler-icons.ttf")]); + cx.add_stylesheet(include_style!("src/theme.css")).expect("Failed to find stylesheet"); + + // cx.emit(EnvironmentEvent::SetThemeMode(ThemeMode::DarkMode)); + AppData::new().build(cx); HStack::new(cx, |cx| { // Treeview diff --git a/playground/src/properties.rs b/playground/src/properties.rs index 6868e27d..d1eb3e35 100644 --- a/playground/src/properties.rs +++ b/playground/src/properties.rs @@ -1,8 +1,15 @@ -use vizia::{fonts::icons_names::DOWN, prelude::*}; +use vizia::icons::{ + ICON_ARROW_AUTOFIT_HEIGHT, ICON_ARROW_AUTOFIT_WIDTH, ICON_ARROW_BAR_DOWN, ICON_ARROW_BAR_LEFT, + ICON_ARROW_BAR_RIGHT, ICON_ARROW_BAR_UP, ICON_BOX_ALIGN_BOTTOM, ICON_BOX_ALIGN_BOTTOM_LEFT, + ICON_BOX_ALIGN_BOTTOM_RIGHT, ICON_BOX_ALIGN_LEFT, ICON_BOX_ALIGN_RIGHT, ICON_BOX_ALIGN_TOP, + ICON_BOX_ALIGN_TOP_LEFT, ICON_BOX_ALIGN_TOP_RIGHT, ICON_BOX_MARGIN, ICON_LAYOUT_ALIGN_BOTTOM, + ICON_LAYOUT_ALIGN_LEFT, ICON_LAYOUT_ALIGN_RIGHT, ICON_LAYOUT_ALIGN_TOP, ICON_LAYOUT_DISTRIBUTE_HORIZONTAL, + ICON_LAYOUT_DISTRIBUTE_VERTICAL, +}; +use vizia::prelude::*; use morphorm as morph; -use crate::icons::*; use crate::{AppData, AppEvent}; pub struct PropertiesPanel {} @@ -16,81 +23,40 @@ impl PropertiesPanel { Label::new(cx, "Space and Size").class("panel-title"); HStack::new(cx, |cx| { - Label::new(cx, "Position Type").width(Auto); - Dropdown::new( - cx, - move |cx| - // A Label and an Icon - HStack::new(cx, move |cx|{ - Label::new(cx, AppData::position_type.map(|position_type| match position_type { - morph::PositionType::ParentDirected => "Parent Directed", - morph::PositionType::SelfDirected => "Self Directed", - })).width(Auto); - Label::new(cx, DOWN).class("icon").width(Auto); - }) - .child_left(Pixels(5.0)) - .child_right(Pixels(5.0)) - .col_between(Stretch(1.0)), - move |cx| { - List::new(cx, AppData::position_type_list, |cx, _, item| { - Label::new(cx, item) - .width(Stretch(1.0)) - .child_top(Stretch(1.0)) - .child_bottom(Stretch(1.0)) - .child_left(Pixels(5.0)) - .bind( - AppData::position_type.map(|position_type| match position_type { - morph::PositionType::ParentDirected => "Parent Directed", - morph::PositionType::SelfDirected => "Self Directed", - }), - move |handle, selected| { - if item.get(handle.cx) == selected.get(handle.cx) { - handle.background_color(Color::from("#4871ae")); - } else { - handle.background_color(Color::transparent()); - } - }, - ) - .on_press(move |cx| { - cx.emit(AppEvent::SetPositionType(item.get(cx))); - cx.emit(PopupEvent::Close); - }); - }); - }, - ) - .width(Stretch(1.0)); + Label::new(cx, "Position Type"); + PickList::new(cx, AppData::position_type_list, AppData::selected_position_type, true) + .on_select(|cx, index| cx.emit(AppEvent::SetPositionType(index))) + .width(Stretch(1.0)); }) - .col_between(Pixels(10.0)) - .height(Auto) .class("row"); HStack::new(cx, |cx| { - VStack::new(cx, |cx| { - unit_box(cx, ICON_ARROW_BAR_RIGHT, AppData::left, AppEvent::SetLeft); - }); + // VStack::new(cx, |cx| { + unit_box(cx, ICON_ARROW_BAR_RIGHT, AppData::left, AppEvent::SetLeft); + // }).height(Auto); - VStack::new(cx, |cx| { - unit_box(cx, ICON_ARROW_AUTOFIT_WIDTH, AppData::width, AppEvent::SetWidth); - }); + // VStack::new(cx, |cx| { + unit_box(cx, ICON_ARROW_AUTOFIT_WIDTH, AppData::width, AppEvent::SetWidth); + // }).height(Auto); - VStack::new(cx, |cx| { - unit_box(cx, ICON_ARROW_BAR_LEFT, AppData::right, AppEvent::SetRight); - }); + // VStack::new(cx, |cx| { + unit_box(cx, ICON_ARROW_BAR_LEFT, AppData::right, AppEvent::SetRight); + // }).height(Auto); }) .class("row"); HStack::new(cx, |cx| { - VStack::new(cx, |cx| { - unit_box(cx, ICON_ARROW_BAR_DOWN, AppData::top, AppEvent::SetTop); - }); + // VStack::new(cx, |cx| { + unit_box(cx, ICON_ARROW_BAR_DOWN, AppData::top, AppEvent::SetTop); + // }).height(Auto); - VStack::new(cx, |cx| { - unit_box(cx, ICON_ARROW_AUTOFIT_HEIGHT, AppData::height, AppEvent::SetHeight); - }); + // VStack::new(cx, |cx| { + unit_box(cx, ICON_ARROW_AUTOFIT_HEIGHT, AppData::height, AppEvent::SetHeight); + // }).height(Auto); - VStack::new(cx, |cx| { - unit_box(cx, ICON_ARROW_BAR_UP, AppData::bottom, AppEvent::SetBottom); - }); + // VStack::new(cx, |cx| { + unit_box(cx, ICON_ARROW_BAR_UP, AppData::bottom, AppEvent::SetBottom); + // }).height(Auto); }) .col_between(Pixels(10.0)) .height(Auto) @@ -239,92 +205,41 @@ impl PropertiesPanel { Label::new(cx, "Child Layout").class("panel-title"); HStack::new(cx, |cx| { Label::new(cx, "Layout Type").width(Auto); - Dropdown::new( - cx, - move |cx| - // A Label and an Icon - HStack::new(cx, move |cx|{ - Label::new(cx, AppData::layout_type.map(|layout_type| match layout_type { - morph::LayoutType::Row => "Row", - morph::LayoutType::Column => "Column", - })).width(Auto); - Label::new(cx, DOWN).class("icon").width(Auto); - }) - .child_left(Pixels(5.0)) - .child_right(Pixels(5.0)) - .col_between(Stretch(1.0)), - move |cx| { - List::new(cx, AppData::layout_type_list, |cx, _, item| { - Label::new(cx, item) - .width(Stretch(1.0)) - .child_top(Stretch(1.0)) - .child_bottom(Stretch(1.0)) - .child_left(Pixels(5.0)) - .bind( - AppData::layout_type.map(|layout_type| match layout_type { - morph::LayoutType::Row => "Row", - morph::LayoutType::Column => "Column", - }), - move |handle, selected| { - if item.get(handle.cx) == selected.get(handle.cx) { - handle.background_color(Color::from("#4871ae")); - } else { - handle.background_color(Color::transparent()); - } - }, - ) - .on_press(move |cx| { - cx.emit(AppEvent::SetLayoutType(item.get(cx))); - cx.emit(PopupEvent::Close); - }); - }); - }, - ) - .width(Stretch(1.0)); + PickList::new(cx, AppData::layout_type_list, AppData::selected_layout_type, true) + .on_select(|cx, index| cx.emit(AppEvent::SetLayoutType(index))) + .width(Stretch(1.0)); }) .col_between(Pixels(10.0)) .height(Auto) .class("row"); HStack::new(cx, |cx| { - VStack::new(cx, |cx| { - unit_box(cx, ICON_LAYOUT_ALIGN_LEFT, AppData::child_left, AppEvent::SetChildLeft); - }); - - VStack::new(cx, |cx| { - unit_box( - cx, - ICON_LAYOUT_DISTRIBUTE_VERTICAL, - AppData::col_between, - AppEvent::SetColBetween, - ); - }); - - VStack::new(cx, |cx| { - unit_box(cx, ICON_LAYOUT_ALIGN_RIGHT, AppData::child_right, AppEvent::SetChildRight); - }); + unit_box(cx, ICON_LAYOUT_ALIGN_LEFT, AppData::child_left, AppEvent::SetChildLeft); + + unit_box( + cx, + ICON_LAYOUT_DISTRIBUTE_VERTICAL, + AppData::col_between, + AppEvent::SetColBetween, + ); + + unit_box(cx, ICON_LAYOUT_ALIGN_RIGHT, AppData::child_right, AppEvent::SetChildRight); }) .col_between(Pixels(10.0)) .height(Auto) .class("row"); HStack::new(cx, |cx| { - VStack::new(cx, |cx| { - unit_box(cx, ICON_LAYOUT_ALIGN_TOP, AppData::child_top, AppEvent::SetChildTop); - }); - - VStack::new(cx, |cx| { - unit_box( - cx, - ICON_LAYOUT_DISTRIBUTE_HORIZONTAL, - AppData::row_between, - AppEvent::SetRowBetween, - ); - }); - - VStack::new(cx, |cx| { - unit_box(cx, ICON_LAYOUT_ALIGN_BOTTOM, AppData::child_bottom, AppEvent::SetChildBottom); - }); + unit_box(cx, ICON_LAYOUT_ALIGN_TOP, AppData::child_top, AppEvent::SetChildTop); + + unit_box( + cx, + ICON_LAYOUT_DISTRIBUTE_HORIZONTAL, + AppData::row_between, + AppEvent::SetRowBetween, + ); + + unit_box(cx, ICON_LAYOUT_ALIGN_BOTTOM, AppData::child_bottom, AppEvent::SetChildBottom); }) .col_between(Pixels(10.0)) .height(Auto) @@ -343,7 +258,7 @@ impl PropertiesPanel { cx.emit(AppEvent::AlignChildTop); cx.emit(AppEvent::AlignChildLeft); }, - |cx| Label::new(cx, ICON_BOX_ALIGN_TOP_LEFT).class("icons"), + |cx| Icon::new(cx, ICON_BOX_ALIGN_TOP_LEFT), ); Button::new( @@ -352,7 +267,7 @@ impl PropertiesPanel { cx.emit(AppEvent::AlignChildTop); cx.emit(AppEvent::AlignChildCenter); }, - |cx| Label::new(cx, ICON_BOX_ALIGN_TOP).class("icons"), + |cx| Icon::new(cx, ICON_BOX_ALIGN_TOP), ); Button::new( @@ -361,9 +276,10 @@ impl PropertiesPanel { cx.emit(AppEvent::AlignChildTop); cx.emit(AppEvent::AlignChildRight); }, - |cx| Label::new(cx, ICON_BOX_ALIGN_TOP_RIGHT).class("icons"), + |cx| Icon::new(cx, ICON_BOX_ALIGN_TOP_RIGHT), ); }) + .height(Auto) .child_left(Stretch(1.0)) .child_right(Stretch(1.0)); @@ -374,7 +290,7 @@ impl PropertiesPanel { cx.emit(AppEvent::AlignChildMiddle); cx.emit(AppEvent::AlignChildLeft); }, - |cx| Label::new(cx, ICON_BOX_ALIGN_LEFT).class("icons"), + |cx| Icon::new(cx, ICON_BOX_ALIGN_LEFT), ); Button::new( @@ -383,7 +299,7 @@ impl PropertiesPanel { cx.emit(AppEvent::AlignChildMiddle); cx.emit(AppEvent::AlignChildCenter); }, - |cx| Label::new(cx, ICON_BOX_MARGIN).class("icons"), + |cx| Icon::new(cx, ICON_BOX_MARGIN), ); Button::new( @@ -392,9 +308,10 @@ impl PropertiesPanel { cx.emit(AppEvent::AlignChildMiddle); cx.emit(AppEvent::AlignChildRight); }, - |cx| Label::new(cx, ICON_BOX_ALIGN_RIGHT).class("icons"), + |cx| Icon::new(cx, ICON_BOX_ALIGN_RIGHT), ); }) + .height(Auto) .child_left(Stretch(1.0)) .child_right(Stretch(1.0)); @@ -405,7 +322,7 @@ impl PropertiesPanel { cx.emit(AppEvent::AlignChildBottom); cx.emit(AppEvent::AlignChildLeft); }, - |cx| Label::new(cx, ICON_BOX_ALIGN_BOTTOM_LEFT).class("icons"), + |cx| Icon::new(cx, ICON_BOX_ALIGN_BOTTOM_LEFT), ); Button::new( @@ -414,7 +331,7 @@ impl PropertiesPanel { cx.emit(AppEvent::AlignChildBottom); cx.emit(AppEvent::AlignChildCenter); }, - |cx| Label::new(cx, ICON_BOX_ALIGN_BOTTOM).class("icons"), + |cx| Icon::new(cx, ICON_BOX_ALIGN_BOTTOM), ); Button::new( @@ -423,9 +340,10 @@ impl PropertiesPanel { cx.emit(AppEvent::AlignChildBottom); cx.emit(AppEvent::AlignChildRight); }, - |cx| Label::new(cx, ICON_BOX_ALIGN_BOTTOM_RIGHT).class("icons"), + |cx| Icon::new(cx, ICON_BOX_ALIGN_BOTTOM_RIGHT), ); }) + .height(Auto) .child_left(Stretch(1.0)) .child_right(Stretch(1.0)); }) diff --git a/playground/src/tabler-icons.ttf b/playground/src/tabler-icons.ttf deleted file mode 100644 index b8e542d7..00000000 Binary files a/playground/src/tabler-icons.ttf and /dev/null differ diff --git a/playground/src/tree_panel.rs b/playground/src/tree_panel.rs index e25cb739..a9e09053 100644 --- a/playground/src/tree_panel.rs +++ b/playground/src/tree_panel.rs @@ -1,10 +1,8 @@ use morphorm::Node; +use vizia::icons::{ICON_CHEVRON_DOWN, ICON_LAYOUT_LIST, ICON_ROW_INSERT_BOTTOM, ICON_SQUARE_PLUS, ICON_TRASH}; use vizia::prelude::*; -use crate::{ - icons::{ICON_CHEVRON_DOWN, ICON_LAYOUT_LIST, ICON_ROW_INSERT_BOTTOM, ICON_SQUARE_PLUS, ICON_TRASH}, - AppData, AppEvent, -}; +use crate::{AppData, AppEvent}; pub struct TreePanel {} diff --git a/src/layout.rs b/src/layout.rs index 2250bcb8..f5cb5ad2 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -128,9 +128,7 @@ where let border_cross_after = node.border_cross_after(store, parent_layout_type).to_px(computed_cross, DEFAULT_BORDER_WIDTH); - let node_children = node - .children(tree) - .filter(|child| child.visible(store)); + let node_children = node.children(tree).filter(|child| child.visible(store)); // Get the total number of children of the node. let num_children = node_children.count();