Skip to content

Commit

Permalink
use partial_cmp
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Jan 5, 2022
1 parent a1e3c5c commit 80ce18e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/bevy_sprite/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ pub fn prepare_sprites(
// sort first by z and then by handle. this ensures that, when possible, batches span multiple z layers
// batches won't span z-layers if there is another batch between them
extracted_sprites.sprites.sort_by(|a, b| {
match FloatOrd(a.transform.w_axis[2]).cmp(&FloatOrd(b.transform.w_axis[2])) {
Ordering::Equal => a.handle.cmp(&b.handle),
other => other,
match a.transform.w_axis[2].partial_cmp(&b.transform.w_axis[2]) {
Some(Ordering::Equal) | None => a.handle.cmp(&b.handle),
Some(other) => other,
}
});

Expand Down

0 comments on commit 80ce18e

Please sign in to comment.