fix underflow when calculating new bounds
This commit is contained in:
parent
c1ab626307
commit
6f935f3449
1 changed files with 2 additions and 2 deletions
|
|
@ -246,8 +246,8 @@ impl Rectangle<f32> {
|
|||
let top_left = self.position().snap();
|
||||
let bottom_right = (self.position() + self.size().into()).snap();
|
||||
|
||||
let width = bottom_right.x - top_left.x;
|
||||
let height = bottom_right.y - top_left.y;
|
||||
let width = bottom_right.x.checked_sub(top_left.x)?;
|
||||
let height = bottom_right.y.checked_sub(top_left.y)?;
|
||||
|
||||
if width < 1 || height < 1 {
|
||||
return None;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue