change to fit new api
@@ -223,7 +223,12 @@ fn layout(
let status_size = self.status.layout(ctx, bc, data, env);
for (p, panel) in self.panels.iter_mut() {
- panel.layout(ctx, bc, data, env);
+ panel.layout(
+ ctx,
+ &BoxConstraints::new(Size::ZERO, Size::ZERO),
+ data,
+ env,
+ );
}
let state = LAPCE_APP_STATE.get_tab_state(&self.window_id, &self.tab_id);
@@ -303,28 +308,35 @@ fn layout(
let mut main_split_width = self_size.width;
if let Some(left) = left {
main_split_width -= left;
- self.panels
- .get_mut(&PanelPosition::LeftTop)
- .unwrap()
- .set_layout_rect(
+ let panel = self.panels.get_mut(&PanelPosition::LeftTop).unwrap();
+ panel.layout(
ctx,
+ &BoxConstraints::tight(Size::new(
+ left,
+ self_size.height - status_size.height,
+ )),
data,
env,
- Size::new(left, self_size.height - status_size.height).to_rect(),
);
+ panel.set_origin(ctx, data, env, Point::ZERO);
}
if let Some(right) = right {
main_split_width -= right;
- self.panels
- .get_mut(&PanelPosition::RightTop)
- .unwrap()
- .set_layout_rect(
+ let panel = self.panels.get_mut(&PanelPosition::RightTop).unwrap();
+ panel.layout(
ctx,
+ &BoxConstraints::tight(Size::new(
+ right,
+ self_size.height - status_size.height,
+ )),
data,
env,
- Size::new(right, self_size.height - status_size.height)
- .to_rect()
- .with_origin(Point::new(self_size.width - right, 0.0)),
+ );
+ panel.set_origin(
+ ctx,
+ data,
+ env,
+ Point::new(self_size.width - right, 0.0),
);
}
@@ -336,16 +348,21 @@ fn layout(
let mut main_split_height = self_size.height - status_size.height;
if let Some(bottom) = bottom {
main_split_height -= bottom;
- self.panels
- .get_mut(&PanelPosition::BottomLeft)
- .unwrap()
- .set_layout_rect(
+ let panel = self.panels.get_mut(&PanelPosition::BottomLeft).unwrap();
+ panel.layout(
+ ctx,
+ &BoxConstraints::new(
+ Size::ZERO,
+ Size::new(main_split_width, bottom),
+ ),
+ data,
+ env,
+ );
+ panel.set_origin(
ctx,
data,
env,
- Size::new(main_split_width, bottom)
- .to_rect()
- .with_origin(main_split_origin + (0.0, main_split_height)),
+ main_split_origin + (0.0, main_split_height),
);
}
