Prevent ImageBundles from causing constant layout recalculations (#1299)
Prevent ImageBundles from causing constant layout recalculations
This commit is contained in:
parent
32acbfb632
commit
5edf2d2395
@ -27,10 +27,14 @@ pub fn image_node_system(
|
|||||||
.and_then(|material| material.texture.as_ref())
|
.and_then(|material| material.texture.as_ref())
|
||||||
.and_then(|texture_handle| textures.get(texture_handle))
|
.and_then(|texture_handle| textures.get(texture_handle))
|
||||||
{
|
{
|
||||||
calculated_size.size = Size {
|
let size = Size {
|
||||||
width: texture.size.width as f32,
|
width: texture.size.width as f32,
|
||||||
height: texture.size.height as f32,
|
height: texture.size.height as f32,
|
||||||
};
|
};
|
||||||
|
// Update only if size has changed to avoid needless layout calculations
|
||||||
|
if size != calculated_size.size {
|
||||||
|
calculated_size.size = size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user