Merge pull request #4 from rotcan/topic-scroll-size-fix

Scroll elements size fix
This commit is contained in:
Piotr Siuszko 2025-01-24 12:31:26 +01:00 committed by GitHub
commit 2c9e8f45ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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: {}",