fix scale

This commit is contained in:
Daniel Bulant 2023-10-19 22:26:23 +02:00
parent aa6af36836
commit f85cc62f1f
2 changed files with 5 additions and 5 deletions

View file

@ -110,9 +110,9 @@ fn main() {
let height: NonZeroU32 = NonZeroU32::new(size.height).unwrap(); let height: NonZeroU32 = NonZeroU32::new(size.height).unwrap();
surface.resize(&buffer_context, width, height); surface.resize(&buffer_context, width, height);
let mut groot = groot.write().unwrap(); let mut groot = groot.write().unwrap();
let scale_factor = window.scale_factor(); // let scale_factor = window.scale_factor();
groot.style.layout.size.width = Dimension::Points(size.width as f32 * scale_factor as f32); groot.style.layout.size.width = Dimension::Points(size.width as f32);
groot.style.layout.size.height = Dimension::Points(size.height as f32 * scale_factor as f32); groot.style.layout.size.height = Dimension::Points(size.height as f32);
drop(groot); drop(groot);
window.request_redraw(); window.request_redraw();
}, },
@ -131,7 +131,7 @@ fn main() {
} }
} }
context.taffy.compute_layout(*context.taffy_map.get(&root).unwrap(), Size::MAX_CONTENT).unwrap(); context.taffy.compute_layout(*context.taffy_map.get(&root).unwrap(), Size::MAX_CONTENT).unwrap();
// dbg!(&root); dbg!(&root);
render(&buffer_context, &surface, &window, &mut context, &root); render(&buffer_context, &surface, &window, &mut context, &root);
}, },
_ => {} _ => {}

View file

@ -86,7 +86,7 @@ pub fn render_recursively(node: &SharedGNode, context: &mut RenderContext<OpenGl
let sself = node.clone(); let sself = node.clone();
context.canvas.save(); context.canvas.save();
context.canvas.translate(layout.location.x, layout.location.y); context.canvas.translate(layout.location.x, layout.location.y);
dbg!(node, layout); // dbg!(node, layout);
match styles.overflow { match styles.overflow {
Overflow::Visible => {}, Overflow::Visible => {},
Overflow::Hidden => { Overflow::Hidden => {