private static double magnificationToScale(double magnification) {
    return magnification < 0 ? 1f / (1 - magnification) : (1 + magnification);
  }
private static double magnificationToScale(double magnification)