(scales, target)
| 826 | } |
| 827 | |
| 828 | findNearest(scales, target) { |
| 829 | let resultIndex = 0; |
| 830 | let targetScaleD = target; |
| 831 | for (let i = 1, len = scales.length; i < len; i++) { |
| 832 | if (Math.abs(scales[i] - targetScaleD) < Math.abs(scales[resultIndex] - targetScaleD)) { |
| 833 | resultIndex = i; |
| 834 | } |
| 835 | } |
| 836 | return scales[resultIndex]; |
| 837 | } |
| 838 | |
| 839 | /** |
| 840 | * @private |