smooth.js 1.1 KB

1234567891011121314151617181920212223
  1. var __rest = (this && this.__rest) || function (s, e) {
  2. var t = {};
  3. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  4. t[p] = s[p];
  5. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  6. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  7. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  8. t[p[i]] = s[p[i]];
  9. }
  10. return t;
  11. };
  12. import { curveCatmullRom, curveCatmullRomClosed } from 'd3-shape';
  13. import { isPolar } from '../../utils/coordinate';
  14. import { Curve } from './curve';
  15. export const Smooth = (options) => {
  16. const { alpha = 0.5 } = options, rest = __rest(options, ["alpha"]);
  17. return (P, value, coordinate, theme) => {
  18. const curve = isPolar(coordinate) ? curveCatmullRomClosed : curveCatmullRom;
  19. return Curve(Object.assign({ curve: curve.alpha(alpha) }, rest))(P, value, coordinate, theme);
  20. };
  21. };
  22. Smooth.props = Object.assign(Object.assign({}, Curve.props), { defaultMarker: 'smooth' });
  23. //# sourceMappingURL=smooth.js.map