I'd suggest moving this line up and using `rect` rather than `obj->getBounds()` twice in the above check. Also that check does not need to be an `else` since if the previous condition has matched it would have stopped at `continue` already.