I’m probably just missing something here, but there seems to be some mismatch with the Rect constructor and Contains function.
The constructor has you define the left, top, width and height.
However, when contains is called, it treats the top as the bottom.
Here’s a simple C# test:
Vector2 testPoint = new Vector2(0.5f, 0.5f);
// new Rect(left, top, width, height) ?
// should define space between (0,1) and (1,0), and contain (0.5,0.5)
Rect topDefinedRect = new Rect(0,1,1,1);
if (topDefinedRect.Contains(testPoint))
print ("point within topDefinedRect");
// should define space between (0,0) and (1,-1) , and not contain (0.5,0.5)
Rect bottomDefinedRect = new Rect(0,0,1,1);
if (bottomDefinedRect.Contains(testPoint))
print ("point within bottomDefinedRect");
And the resulting output:
Maybe I’m just missing something really obvious?