this could be written more compact though if you move (root.viewBox ? ... : 1) to the polys.ellipse(...) call. it would save 8 lines of code.