Adapt according to the smaller of width or height
double radius(num r) => r * min(scaleWidth, scaleHeight);