5945485d6a98c780a3ffa96e07a90cdee8823d5941ff96b4e73b16a2121121ddfff1cd6d7e76fac1cfe1604213a02d91ac9864449be80b72849445eeecd077 1.1 KB

123456789101112131415161718192021
  1. /**
  2. * Calculate slider move result.
  3. * Usage:
  4. * (1) If both handle0 and handle1 are needed to be moved, set minSpan the same as
  5. * maxSpan and the same as `Math.abs(handleEnd[1] - handleEnds[0])`.
  6. * (2) If handle0 is forbidden to cross handle1, set minSpan as `0`.
  7. *
  8. * @param delta Move length.
  9. * @param handleEnds handleEnds[0] can be bigger then handleEnds[1].
  10. * handleEnds will be modified in this method.
  11. * @param extent handleEnds is restricted by extent.
  12. * extent[0] should less or equals than extent[1].
  13. * @param handleIndex Can be 'all', means that both move the two handleEnds.
  14. * @param minSpan The range of dataZoom can not be smaller than that.
  15. * If not set, handle0 and cross handle1. If set as a non-negative
  16. * number (including `0`), handles will push each other when reaching
  17. * the minSpan.
  18. * @param maxSpan The range of dataZoom can not be larger than that.
  19. * @return The input handleEnds.
  20. */
  21. export default function sliderMove(delta: number, handleEnds: number[], extent: number[], handleIndex: 'all' | 0 | 1, minSpan?: number, maxSpan?: number): number[];