Resolve size using limits
This commit is contained in:
parent
8efebfcd07
commit
9e389b629b
2 changed files with 7 additions and 2 deletions
|
|
@ -105,6 +105,8 @@ where
|
||||||
) -> layout::Node {
|
) -> layout::Node {
|
||||||
let instant = Instant::now();
|
let instant = Instant::now();
|
||||||
|
|
||||||
|
let limits = limits.width(Length::Shrink).height(Length::Shrink);
|
||||||
|
|
||||||
let shape = self.line.shape_opt().as_ref().unwrap();
|
let shape = self.line.shape_opt().as_ref().unwrap();
|
||||||
|
|
||||||
//TODO: can we cache this?
|
//TODO: can we cache this?
|
||||||
|
|
@ -128,7 +130,7 @@ where
|
||||||
|
|
||||||
log::debug!("layout {:?} in {:?}", size, instant.elapsed());
|
log::debug!("layout {:?} in {:?}", size, instant.elapsed());
|
||||||
|
|
||||||
layout::Node::new(size)
|
layout::Node::new(limits.resolve(size))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw(
|
fn draw(
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,8 @@ where
|
||||||
_renderer: &Renderer,
|
_renderer: &Renderer,
|
||||||
limits: &layout::Limits,
|
limits: &layout::Limits,
|
||||||
) -> layout::Node {
|
) -> layout::Node {
|
||||||
|
let limits = limits.width(Length::Fill).height(Length::Fill);
|
||||||
|
|
||||||
//TODO: allow lazy shape
|
//TODO: allow lazy shape
|
||||||
let mut editor = self.editor.lock().unwrap();
|
let mut editor = self.editor.lock().unwrap();
|
||||||
editor.buffer.shape_until(i32::max_value());
|
editor.buffer.shape_until(i32::max_value());
|
||||||
|
|
@ -103,7 +105,8 @@ where
|
||||||
let height = layout_lines as f32 * editor.buffer.metrics().line_height as f32;
|
let height = layout_lines as f32 * editor.buffer.metrics().line_height as f32;
|
||||||
let size = Size::new(limits.max().width, height);
|
let size = Size::new(limits.max().width, height);
|
||||||
log::info!("size {:?}", size);
|
log::info!("size {:?}", size);
|
||||||
layout::Node::new(size)
|
|
||||||
|
layout::Node::new(limits.resolve(size))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mouse_interaction(
|
fn mouse_interaction(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue