@antv/g2
Version:
the Grammar of Graphics in Javascript
24 lines • 1.14 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import { curveCatmullRomClosed, curveCatmullRom } from 'd3-shape';
import { isPolar } from '../../utils/coordinate';
import { Curve } from './curve';
export const Smooth = (options, context) => {
const { alpha = 0.5 } = options, rest = __rest(options, ["alpha"]);
const { coordinate } = context;
return (...params) => {
const curve = isPolar(coordinate) ? curveCatmullRomClosed : curveCatmullRom;
return Curve(Object.assign({ curve: curve.alpha(alpha) }, rest), context)(...params);
};
};
Smooth.props = Object.assign(Object.assign({}, Curve.props), { defaultMarker: 'smooth' });
//# sourceMappingURL=smooth.js.map