Scroll elements size fix

This commit is contained in:
Rahul Srivastava 2025-01-15 14:47:37 +05:30
parent 175914f65c
commit c9f0844c02
1 changed files with 2 additions and 2 deletions

View File

@ -128,13 +128,13 @@ fn update_size(
mut content_q: Query<(&mut ScrollableContent, &ComputedNode), Changed<ComputedNode>>, mut content_q: Query<(&mut ScrollableContent, &ComputedNode), Changed<ComputedNode>>,
) { ) {
for (children, node) in q.iter_mut() { for (children, node) in q.iter_mut() {
let container_height = node.size().y; let container_height = node.size().y * node.inverse_scale_factor();
for &child in children.iter() { for &child in children.iter() {
let Ok((mut scroll, node)) = content_q.get_mut(child) else { let Ok((mut scroll, node)) = content_q.get_mut(child) else {
continue; continue;
}; };
scroll.max_scroll = (node.size().y - container_height).max(0.0); scroll.max_scroll = (node.size().y * node.inverse_scale_factor()- container_height).max(0.0);
#[cfg(feature = "extra_logs")] #[cfg(feature = "extra_logs")]
info!( info!(
"CONTAINER {}, max_scroll: {}", "CONTAINER {}, max_scroll: {}",