diff --git a/examples/editor-libcosmic/src/text.rs b/examples/editor-libcosmic/src/text.rs index 2767e62..750ef19 100644 --- a/examples/editor-libcosmic/src/text.rs +++ b/examples/editor-libcosmic/src/text.rs @@ -105,6 +105,8 @@ where ) -> layout::Node { let instant = Instant::now(); + let limits = limits.width(Length::Shrink).height(Length::Shrink); + let shape = self.line.shape_opt().as_ref().unwrap(); //TODO: can we cache this? @@ -128,7 +130,7 @@ where log::debug!("layout {:?} in {:?}", size, instant.elapsed()); - layout::Node::new(size) + layout::Node::new(limits.resolve(size)) } fn draw( diff --git a/examples/editor-libcosmic/src/text_box.rs b/examples/editor-libcosmic/src/text_box.rs index dda9abb..f0e8b88 100644 --- a/examples/editor-libcosmic/src/text_box.rs +++ b/examples/editor-libcosmic/src/text_box.rs @@ -88,6 +88,8 @@ where _renderer: &Renderer, limits: &layout::Limits, ) -> layout::Node { + let limits = limits.width(Length::Fill).height(Length::Fill); + //TODO: allow lazy shape let mut editor = self.editor.lock().unwrap(); 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 size = Size::new(limits.max().width, height); log::info!("size {:?}", size); - layout::Node::new(size) + + layout::Node::new(limits.resolve(size)) } fn mouse_interaction(