wip: update to use latest iced
This commit is contained in:
parent
ca1469a6b2
commit
f4ad098647
49 changed files with 956 additions and 854 deletions
|
|
@ -43,7 +43,8 @@ pub fn resolve<Message>(
|
|||
|
||||
nodes.push(child_node);
|
||||
|
||||
let (width, justify_self) = match child_widget.width() {
|
||||
let c_size = child_widget.size();
|
||||
let (width, justify_self) = match c_size.width {
|
||||
Length::Fill | Length::FillPortion(_) => (Dimension::Auto, Some(AlignItems::Stretch)),
|
||||
_ => (length(size.width), None),
|
||||
};
|
||||
|
|
@ -62,7 +63,7 @@ pub fn resolve<Message>(
|
|||
},
|
||||
size: taffy::geometry::Size {
|
||||
width,
|
||||
height: match child_widget.height() {
|
||||
height: match c_size.height {
|
||||
Length::Fill | Length::FillPortion(_) => Dimension::Auto,
|
||||
_ => length(size.height),
|
||||
},
|
||||
|
|
@ -165,7 +166,8 @@ pub fn resolve<Message>(
|
|||
{
|
||||
if let Ok(leaf_layout) = taffy.layout(leaf) {
|
||||
let child_widget = child.as_widget();
|
||||
match child_widget.width() {
|
||||
let c_size = child_widget.size();
|
||||
match c_size.width {
|
||||
Length::Fill | Length::FillPortion(_) => {
|
||||
*node =
|
||||
child_widget.layout(tree, renderer, &limits.width(leaf_layout.size.width));
|
||||
|
|
@ -173,10 +175,10 @@ pub fn resolve<Message>(
|
|||
_ => (),
|
||||
}
|
||||
|
||||
node.move_to(Point {
|
||||
*node = node.clone().move_to(Point {
|
||||
x: leaf_layout.location.x,
|
||||
y: leaf_layout.location.y,
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -185,5 +187,5 @@ pub fn resolve<Message>(
|
|||
height: grid_layout.size.height,
|
||||
};
|
||||
|
||||
Node::with_children(grid_size.pad(padding), nodes)
|
||||
Node::with_children(grid_size.expand(padding), nodes)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ impl<'a, Message> Grid<'a, Message> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, Message: 'static + Clone> Widget<Message, Renderer> for Grid<'a, Message> {
|
||||
impl<'a, Message: 'static + Clone> Widget<Message, crate::Theme, Renderer> for Grid<'a, Message> {
|
||||
fn children(&self) -> Vec<Tree> {
|
||||
self.children.iter().map(Tree::new).collect()
|
||||
}
|
||||
|
|
@ -112,12 +112,8 @@ impl<'a, Message: 'static + Clone> Widget<Message, Renderer> for Grid<'a, Messag
|
|||
tree.diff_children(self.children.as_mut_slice());
|
||||
}
|
||||
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
}
|
||||
|
||||
fn height(&self) -> Length {
|
||||
self.height
|
||||
fn size(&self) -> iced_core::Size<Length> {
|
||||
iced_core::Size::new(self.width, self.height)
|
||||
}
|
||||
|
||||
fn layout(
|
||||
|
|
@ -126,10 +122,11 @@ impl<'a, Message: 'static + Clone> Widget<Message, Renderer> for Grid<'a, Messag
|
|||
renderer: &Renderer,
|
||||
limits: &layout::Limits,
|
||||
) -> layout::Node {
|
||||
let size = self.size();
|
||||
let limits = limits
|
||||
.max_width(self.max_width)
|
||||
.width(self.width())
|
||||
.height(self.height());
|
||||
.width(size.width)
|
||||
.height(size.height);
|
||||
|
||||
super::layout::resolve(
|
||||
renderer,
|
||||
|
|
@ -245,7 +242,7 @@ impl<'a, Message: 'static + Clone> Widget<Message, Renderer> for Grid<'a, Messag
|
|||
tree: &'b mut Tree,
|
||||
layout: Layout<'_>,
|
||||
renderer: &Renderer,
|
||||
) -> Option<overlay::Element<'b, Message, Renderer>> {
|
||||
) -> Option<overlay::Element<'b, Message, crate::Theme, Renderer>> {
|
||||
overlay::from_children(&mut self.children, tree, layout, renderer)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue