Fix Rect::operator & (intersection)

Completely neglected to normalize the Rect's size. Somehow completely asymptomatic unless looking at the favourites menu if it's too long to fit on the screen, on MacOS. Yeah.

Another in the series of fixes for easily avoidable problems introduced in c2bb77721208 by my infinite wisdom >_>. The previous (and thankfully, first) commit in the series is 8cab4ab73819.
This commit is contained in:
Tamás Bálint Misius 2024-12-30 15:19:54 +01:00
parent a32f0fe178
commit 6dd0e9533f
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -367,7 +367,8 @@ public:
{
auto tl = Vec2<T>(std::max(pos.X , other.pos.X ), std::max(pos.Y , other.pos.Y ));
auto br1 = Vec2<T>(std::min(pos.X + size.X, other.pos.X + other.size.X), std::min(pos.Y + size.Y, other.pos.Y + other.size.Y));
return Rect<T>(tl, br1 - tl);
auto size = br1 - tl;
return Rect<T>(tl, Vec2<T>(std::max(size.X, T(0)), std::max(size.Y, T(0))));
}
inline Rect<T> &operator&=(Rect<T> other)