1
0
Fork 0
forked from wry/wry

rect: fix dist_squared calculation

This commit is contained in:
Julian Orth 2024-07-24 01:14:06 +02:00
parent 086f3eb4f8
commit 09145480e1

View file

@ -128,13 +128,13 @@ impl Rect {
if self.raw.x1 > x {
dx = self.raw.x1 - x;
} else if self.raw.x2 < x {
dx = x - self.raw.x1;
dx = x - self.raw.x2;
}
let mut dy = 0;
if self.raw.y1 > y {
dy = self.raw.y1 - y;
} else if self.raw.y2 < y {
dy = y - self.raw.y1;
dy = y - self.raw.y2;
}
dx * dx + dy * dy
}