Menu: align tree in MenuState::layout
This commit is contained in:
parent
6a8447d70f
commit
c2aae2e79b
1 changed files with 6 additions and 4 deletions
|
|
@ -328,8 +328,7 @@ impl MenuState {
|
||||||
.iter()
|
.iter()
|
||||||
.zip(self.menu_bounds.child_sizes[start_index..=end_index].iter())
|
.zip(self.menu_bounds.child_sizes[start_index..=end_index].iter())
|
||||||
.zip(menu_tree.children[start_index..=end_index].iter())
|
.zip(menu_tree.children[start_index..=end_index].iter())
|
||||||
.zip(tree[start_index..=end_index].iter_mut())
|
.map(|((cp, size), mt)| {
|
||||||
.map(|(((cp, size), mt), tree)| {
|
|
||||||
let mut position = *cp;
|
let mut position = *cp;
|
||||||
let mut size = *size;
|
let mut size = *size;
|
||||||
|
|
||||||
|
|
@ -343,7 +342,10 @@ impl MenuState {
|
||||||
|
|
||||||
let limits = Limits::new(Size::ZERO, size);
|
let limits = Limits::new(Size::ZERO, size);
|
||||||
|
|
||||||
let mut node = mt.item.as_widget().layout(tree, renderer, &limits);
|
let mut node = mt
|
||||||
|
.item
|
||||||
|
.as_widget()
|
||||||
|
.layout(&mut tree[mt.index], renderer, &limits);
|
||||||
node.move_to(Point::new(0.0, position + self.scroll_offset));
|
node.move_to(Point::new(0.0, position + self.scroll_offset));
|
||||||
node
|
node
|
||||||
})
|
})
|
||||||
|
|
@ -493,7 +495,7 @@ where
|
||||||
slice,
|
slice,
|
||||||
renderer,
|
renderer,
|
||||||
menu_root,
|
menu_root,
|
||||||
&mut active_tree.children[start_index..=end_index],
|
&mut active_tree.children,
|
||||||
);
|
);
|
||||||
nodes.push(children_node);
|
nodes.push(children_node);
|
||||||
// only the last menu can have a None active index
|
// only the last menu can have a None active index
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue