From 88993fb092fb0391ea42ffd725f680d1c98c95d7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 5 Nov 2020 02:11:11 +0100 Subject: Relayout `UserInterface` on resize in `iced_winit` --- native/src/user_interface.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'native/src/user_interface.rs') diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index 59d91f42..504dbe0f 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -388,6 +388,23 @@ where } } + /// Relayouts and returns a new [`UserInterface`] using the provided + /// bounds. + /// + /// [`UserInterface`]: struct.UserInterface.html + pub fn relayout(self, bounds: Size, renderer: &mut Renderer) -> Self { + Self::build( + self.root, + bounds, + Cache { + base: self.base, + overlay: self.overlay, + bounds: self.bounds, + }, + renderer, + ) + } + /// Extract the [`Cache`] of the [`UserInterface`], consuming it in the /// process. /// -- cgit