Skip to content

Commit

Permalink
add overlay for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
genusistimelord committed Jul 24, 2024
1 parent 1242f5e commit 598791c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/widgets/menu/menu_bar_overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,27 @@ where
);
}

fn overlay<'c>(
&'c mut self,
layout: Layout<'_>,
renderer: &Renderer,
) -> Option<overlay::Element<'c, Message, Theme, Renderer>> {
let bar = self.tree.state.downcast_ref::<MenuBarState>();
let active = bar.active_root?;
let mut lc = layout.children();
let _bar_bounds = lc.next()?.bounds();
let _roots_layout = lc.next()?;
let menu_layouts_layout = lc.next()?; // Node{0, [menu_node...]}
let mut menu_layouts = menu_layouts_layout.children(); // [menu_node...]
let active_root = &mut self.roots[active];
let active_tree = &mut self.tree.children[active];
let menu = active_root.menu.as_mut()?;
let menu_tree = &mut active_tree.children[1];
let menu_layout = menu_layouts.next()?;

menu.overlay(menu_tree, menu_layout, renderer, Vector::ZERO)
}

fn draw(
&self,
renderer: &mut Renderer,
Expand Down

0 comments on commit 598791c

Please sign in to comment.