code: function proportionalSize(box, width, height) {
    if (height == null)
      height = box.height / box.width * width
    else if (width == null)
      width = box.width / box.height * height
  
    return {
      width:  width
    , height: height
    }
  }
docs: Calculate proportional width and height values when necessary