You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
393 B
19 lines
393 B
import {Path} from "d3-path";
|
|
|
|
export function withPath(shape) {
|
|
let digits = 3;
|
|
|
|
shape.digits = function(_) {
|
|
if (!arguments.length) return digits;
|
|
if (_ == null) {
|
|
digits = null;
|
|
} else {
|
|
const d = Math.floor(_);
|
|
if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
|
|
digits = d;
|
|
}
|
|
return shape;
|
|
};
|
|
|
|
return () => new Path(digits);
|
|
}
|
|
|