Fix default window size on small displays (#40398)
Fixed: #40039 Fixed: #40404 Fixed: #40272 Fixed: #40666 Release Notes: - N/A
This commit is contained in:
@@ -289,10 +289,13 @@ pub trait PlatformDisplay: Send + Sync + Debug {
|
|||||||
|
|
||||||
/// Get the default bounds for this display to place a window
|
/// Get the default bounds for this display to place a window
|
||||||
fn default_bounds(&self) -> Bounds<Pixels> {
|
fn default_bounds(&self) -> Bounds<Pixels> {
|
||||||
let center = self.bounds().center();
|
let bounds = self.bounds();
|
||||||
let offset = DEFAULT_WINDOW_SIZE / 2.0;
|
let center = bounds.center();
|
||||||
|
let clipped_window_size = DEFAULT_WINDOW_SIZE.min(&bounds.size);
|
||||||
|
|
||||||
|
let offset = clipped_window_size / 2.0;
|
||||||
let origin = point(center.x - offset.width, center.y - offset.height);
|
let origin = point(center.x - offset.width, center.y - offset.height);
|
||||||
Bounds::new(origin, DEFAULT_WINDOW_SIZE)
|
Bounds::new(origin, clipped_window_size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user