code: public double[] inverseProjection(int x, int y) {
          double[] sc = new double[2];
  
          double ratio = (canvas.base.upperBound[0] - canvas.base.lowerBound[0]) / (canvas.getWidth() * (1 - 2 * canvas.margin));
          sc[0] = canvas.base.lowerBound[0] + ratio * (x - canvas.getWidth() * canvas.margin);
  
          ratio = (canvas.base.upperBound[1] - canvas.base.lowerBound[1]) / (canvas.getHeight() * (1 - 2 * canvas.margin));
          sc[1] = canvas.base.lowerBound[1] + ratio * (canvas.getHeight() * (1 - canvas.margin) - y);
  
          return sc;
      }
docs: Project the screen coordinate back to the logical coordinates.
  @param x the x of Java2D coordinate in the canvas.
  @param y the y of Java2D coordinate in the canvas