diff --git a/Cargo.toml b/Cargo.toml index b0af6983..4b41ecf0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ default = [ "number_input", "date_picker", "color_picker", - #"floating_element", + "floating_element", #"icon_text", #"grid", #"modal", @@ -89,8 +89,8 @@ members = [ #"examples/cupertino/cupertino_spinner", #"examples/cupertino/cupertino_switch", "examples/date_picker", - #"examples/floating_element", - #"examples/floating_element_anchors", + "examples/floating_element", + "examples/floating_element_anchors", #"examples/grid", #"examples/modal", #"examples/modal_component", diff --git a/src/native/floating_element.rs b/src/native/floating_element.rs index 32a83665..128b9dce 100644 --- a/src/native/floating_element.rs +++ b/src/native/floating_element.rs @@ -126,8 +126,10 @@ where self.underlay.as_widget().height() } - fn layout(&self, renderer: &Renderer, limits: &Limits) -> Node { - self.underlay.as_widget().layout(renderer, limits) + fn layout(&self, tree: &mut Tree, renderer: &Renderer, limits: &Limits) -> Node { + self.underlay + .as_widget() + .layout(&mut tree.children[0], renderer, limits) } fn on_event( diff --git a/src/native/overlay/floating_element.rs b/src/native/overlay/floating_element.rs index da783e43..72e6a10a 100644 --- a/src/native/overlay/floating_element.rs +++ b/src/native/overlay/floating_element.rs @@ -56,12 +56,15 @@ impl<'a, 'b, Message, Renderer> core::Overlay where Renderer: core::Renderer, { - fn layout(&self, renderer: &Renderer, _bounds: Size, position: Point) -> layout::Node { + fn layout(&mut self, renderer: &Renderer, _bounds: Size, position: Point) -> layout::Node { // Constrain overlay to fit inside the underlay's bounds let limits = layout::Limits::new(Size::ZERO, self.underlay_bounds.size()) .width(Length::Fill) .height(Length::Fill); - let mut node = self.element.as_widget().layout(renderer, &limits); + let mut node = self + .element + .as_widget() + .layout(&mut self.state, renderer, &limits); let position = match self.anchor { Anchor::NorthWest => Point::new(position.x + self.offset.x, position.y + self.offset.y),