Implement key events (move and delete) for rectangles.