-
- var pct;
- // xRange[1] - x is unit distance from the right.
- // xRange[1] - xRange[0] is the scale of the range.
- // (xRange[1] - x / (xRange[1] - xRange[0]) is the % from the right.
- // 1 - (that) is the % distance from the left.
- pct = (xRange[1] - x) / (xRange[1] - xRange[0]);
- // There's a way to optimize that, but I'm copying the y-coord function
- // and am lazy.
- return 1 - pct;