diff options
Diffstat (limited to '')
-rw-r--r-- | examples/README.md | 1 | ||||
-rw-r--r-- | native/src/widget/text_input.rs | 12 |
2 files changed, 5 insertions, 8 deletions
diff --git a/examples/README.md b/examples/README.md index bb15dc2e..8d9718a4 100644 --- a/examples/README.md +++ b/examples/README.md @@ -92,7 +92,6 @@ A bunch of simpler examples exist: - [`custom_widget`](custom_widget), a demonstration of how to build a custom widget that draws a circle. - [`download_progress`](download_progress), a basic application that asynchronously downloads a dummy file of 100 MB and tracks the download progress. - [`events`](events), a log of native events displayed using a conditional `Subscription`. -- [`geometry`](geometry), a custom widget showcasing how to draw geometry with the `Mesh2D` primitive in [`iced_wgpu`](../wgpu). - [`integration_opengl`](integration_opengl), a demonstration of how to integrate Iced in an existing OpenGL application. - [`integration_wgpu`](integration_wgpu), a demonstration of how to integrate Iced in an existing [`wgpu`] application. - [`pane_grid`](pane_grid), a grid of panes that can be split, resized, and reorganized. diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index ef2f9a17..14e7e1b7 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -383,19 +383,17 @@ where { let text_size = size.unwrap_or_else(|| renderer.default_size()); - let text_limits = limits + let padding = padding.fit(Size::ZERO, limits.max()); + + let limits = limits .pad(padding) .width(width) .height(Length::Units(text_size)); - let limits = limits.width(width).height(Length::Shrink); - - let mut text = layout::Node::new(text_limits.resolve(Size::ZERO)); - let padding = padding.fit(text.size(), limits.max()); - let size = limits.pad(padding).resolve(text.size()).pad(padding); + let mut text = layout::Node::new(limits.resolve(Size::ZERO)); text.move_to(Point::new(padding.left.into(), padding.top.into())); - layout::Node::with_children(size, vec![text]) + layout::Node::with_children(text.size().pad(padding), vec![text]) } /// Processes an [`Event`] and updates the [`State`] of a [`TextInput`] |