Implementing hit test.