Implemented click detection on rectangles.