1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 15:13:12 -04:00

Prefer the client width/height for the canvas parent (#2804)

This commit is contained in:
Samit Basu
2023-03-29 06:04:04 -07:00
committed by GitHub
parent 24eccca8e6
commit f38904336b

View File

@@ -113,8 +113,10 @@ pub fn resize_canvas_to_screen_size(canvas_id: &str, max_size_points: egui::Vec2
let canvas = canvas_element(canvas_id)?;
let parent = canvas.parent_element()?;
let width = parent.scroll_width();
let height = parent.scroll_height();
// Prefer the client width and height so that if the parent
// element is resized that the egui canvas resizes appropriately.
let width = parent.client_width();
let height = parent.client_height();
let canvas_real_size = Vec2 {
x: width as f32,