calculate SVG ratio correctly