Adjust default-size of Resize areas to fit within screen

This commit is contained in:
Emil Ernerfeldt 2020-12-16 20:31:00 +01:00
parent 91e5295db2
commit 1c9fbc1588

View file

@ -165,7 +165,10 @@ impl Resize {
let default_size = self
.default_size
.at_least(self.min_size)
.at_most(self.max_size);
.at_most(self.max_size)
.at_most(
ui.input().screen_rect().size() - 2.0 * ui.style().spacing.window_padding, // hack for windows
);
State {
desired_size: default_size,
@ -266,6 +269,11 @@ impl Resize {
ui.allocate_space(state.last_content_size);
}
if ui.memory().resize.get(&id).is_none() {
// First frame.
state.desired_size = state.desired_size.at_least(state.last_content_size);
}
// ------------------------------
if self.with_stroke && corner_response.is_some() {