getBoundingClientRect works for both group and polygon.