Added a check when drawing to ensure that the objects are visible.