Skip to content

Commit

Permalink
modal fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
genusistimelord committed Nov 7, 2023
1 parent 10fc6ff commit 96f7616
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ default = [
"color_picker",
"floating_element",
"grid",
#"modal",
"modal",
#"tab_bar",
#"tabs",
#"time_picker",
Expand Down Expand Up @@ -90,8 +90,8 @@ members = [
"examples/floating_element",
"examples/floating_element_anchors",
"examples/grid",
#"examples/modal",
#"examples/modal_component",
"examples/modal",
"examples/modal_component",
#"examples/multiple_modals",
#"examples/tab_bar",
#"examples/tabs",
Expand Down
2 changes: 1 addition & 1 deletion examples/modal/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl Application for ModalExample {
modal(underlay, overlay)
.backdrop(Message::CloseModal)
.on_esc(Message::CloseModal)
.align_y(alignment::Vertical::Top)
.align_y(alignment::Vertical::Center)
.into()
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/native/modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,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(
Expand Down
7 changes: 5 additions & 2 deletions src/native/overlay/modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ where
Renderer: core::Renderer,
Renderer::Theme: StyleSheet,
{
fn layout(&self, renderer: &Renderer, bounds: Size, _position: Point) -> layout::Node {
fn layout(&mut self, renderer: &Renderer, bounds: Size, _position: Point) -> layout::Node {
let limits = layout::Limits::new(Size::ZERO, bounds);
let mut content = self.content.as_widget().layout(renderer, &limits);
let mut content = self
.content
.as_widget()
.layout(&mut self.state, renderer, &limits);

Check failure on line 76 in src/native/overlay/modal.rs

View workflow job for this annotation

GitHub Actions / all

this expression creates a reference which is immediately dereferenced by the compiler
let max_size = limits.max();

content.align(
Expand Down

0 comments on commit 96f7616

Please sign in to comment.