Never Code Tired
| August 30th, 2009Never try to calculate the bounding rectangle of a circle when you’re tired, distracted, or less than fully sober. I must have been some combination of all three of those when I wrote this masterpiece:
public override RectangleF BoundingRect
{
get
{
float x = WorldPos.X - (m_radius / 2.0f);
float y = WorldPos.Y - (m_radius / 2.0f);
return new RectangleF(x, y, m_radius, m_radius);
}
}
I spent an hour this morning wondering why my mouse click code thought my circles were half as big as they were. Sigh.