@mui/x-charts-vendor 7.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -0
- package/d3-color.d.ts +5 -0
- package/d3-color.js +7 -0
- package/d3-delaunay.d.ts +5 -0
- package/d3-delaunay.js +7 -0
- package/d3-interpolate.d.ts +5 -0
- package/d3-interpolate.js +7 -0
- package/d3-scale.d.ts +5 -0
- package/d3-scale.js +7 -0
- package/d3-shape.d.ts +5 -0
- package/d3-shape.js +7 -0
- package/d3-time.d.ts +5 -0
- package/d3-time.js +7 -0
- package/es/d3-array.js +6 -0
- package/es/d3-color.js +6 -0
- package/es/d3-delaunay.js +6 -0
- package/es/d3-format.js +6 -0
- package/es/d3-interpolate.js +6 -0
- package/es/d3-path.js +6 -0
- package/es/d3-scale.js +6 -0
- package/es/d3-shape.js +6 -0
- package/es/d3-time-format.js +6 -0
- package/es/d3-time.js +6 -0
- package/es/delaunator.js +6 -0
- package/es/internmap.js +6 -0
- package/es/robust-predicates.js +6 -0
- package/lib/d3-array.js +6 -0
- package/lib/d3-color.js +6 -0
- package/lib/d3-delaunay.js +6 -0
- package/lib/d3-format.js +6 -0
- package/lib/d3-interpolate.js +6 -0
- package/lib/d3-path.js +6 -0
- package/lib/d3-scale.js +6 -0
- package/lib/d3-shape.js +6 -0
- package/lib/d3-time-format.js +6 -0
- package/lib/d3-time.js +6 -0
- package/lib/delaunator.js +6 -0
- package/lib/internmap.js +6 -0
- package/lib/robust-predicates.js +6 -0
- package/lib-vendor/d3-array/LICENSE +13 -0
- package/lib-vendor/d3-array/dist/d3-array.js +1349 -0
- package/lib-vendor/d3-array/dist/d3-array.min.js +777 -0
- package/lib-vendor/d3-array/src/array.js +9 -0
- package/lib-vendor/d3-array/src/ascending.js +9 -0
- package/lib-vendor/d3-array/src/bin.js +126 -0
- package/lib-vendor/d3-array/src/bisect.js +15 -0
- package/lib-vendor/d3-array/src/bisector.js +59 -0
- package/lib-vendor/d3-array/src/blur.js +122 -0
- package/lib-vendor/d3-array/src/constant.js +9 -0
- package/lib-vendor/d3-array/src/count.js +24 -0
- package/lib-vendor/d3-array/src/cross.js +35 -0
- package/lib-vendor/d3-array/src/cumsum.js +11 -0
- package/lib-vendor/d3-array/src/descending.js +9 -0
- package/lib-vendor/d3-array/src/deviation.js +12 -0
- package/lib-vendor/d3-array/src/difference.js +16 -0
- package/lib-vendor/d3-array/src/disjoint.js +24 -0
- package/lib-vendor/d3-array/src/every.js +16 -0
- package/lib-vendor/d3-array/src/extent.js +35 -0
- package/lib-vendor/d3-array/src/filter.js +17 -0
- package/lib-vendor/d3-array/src/fsum.js +77 -0
- package/lib-vendor/d3-array/src/greatest.js +31 -0
- package/lib-vendor/d3-array/src/greatestIndex.js +23 -0
- package/lib-vendor/d3-array/src/group.js +67 -0
- package/lib-vendor/d3-array/src/groupSort.js +15 -0
- package/lib-vendor/d3-array/src/identity.js +9 -0
- package/lib-vendor/d3-array/src/index.js +539 -0
- package/lib-vendor/d3-array/src/intersection.js +23 -0
- package/lib-vendor/d3-array/src/least.js +31 -0
- package/lib-vendor/d3-array/src/leastIndex.js +23 -0
- package/lib-vendor/d3-array/src/map.js +11 -0
- package/lib-vendor/d3-array/src/max.js +24 -0
- package/lib-vendor/d3-array/src/maxIndex.js +26 -0
- package/lib-vendor/d3-array/src/mean.js +25 -0
- package/lib-vendor/d3-array/src/median.js +16 -0
- package/lib-vendor/d3-array/src/merge.js +14 -0
- package/lib-vendor/d3-array/src/min.js +24 -0
- package/lib-vendor/d3-array/src/minIndex.js +26 -0
- package/lib-vendor/d3-array/src/mode.js +33 -0
- package/lib-vendor/d3-array/src/nice.js +23 -0
- package/lib-vendor/d3-array/src/number.js +26 -0
- package/lib-vendor/d3-array/src/pairs.js +21 -0
- package/lib-vendor/d3-array/src/permute.js +9 -0
- package/lib-vendor/d3-array/src/quantile.js +55 -0
- package/lib-vendor/d3-array/src/quickselect.js +47 -0
- package/lib-vendor/d3-array/src/range.js +16 -0
- package/lib-vendor/d3-array/src/rank.js +30 -0
- package/lib-vendor/d3-array/src/reduce.js +28 -0
- package/lib-vendor/d3-array/src/reverse.js +10 -0
- package/lib-vendor/d3-array/src/scan.js +12 -0
- package/lib-vendor/d3-array/src/shuffle.js +20 -0
- package/lib-vendor/d3-array/src/some.js +16 -0
- package/lib-vendor/d3-array/src/sort.js +45 -0
- package/lib-vendor/d3-array/src/subset.js +11 -0
- package/lib-vendor/d3-array/src/sum.js +24 -0
- package/lib-vendor/d3-array/src/superset.js +28 -0
- package/lib-vendor/d3-array/src/threshold/freedmanDiaconis.js +14 -0
- package/lib-vendor/d3-array/src/threshold/scott.js +14 -0
- package/lib-vendor/d3-array/src/threshold/sturges.js +11 -0
- package/lib-vendor/d3-array/src/ticks.js +60 -0
- package/lib-vendor/d3-array/src/transpose.js +20 -0
- package/lib-vendor/d3-array/src/union.js +16 -0
- package/lib-vendor/d3-array/src/variance.js +31 -0
- package/lib-vendor/d3-array/src/zip.js +11 -0
- package/lib-vendor/d3-color/LICENSE +13 -0
- package/lib-vendor/d3-color/dist/d3-color.js +532 -0
- package/lib-vendor/d3-color/dist/d3-color.min.js +446 -0
- package/lib-vendor/d3-color/src/color.js +366 -0
- package/lib-vendor/d3-color/src/cubehelix.js +61 -0
- package/lib-vendor/d3-color/src/define.js +16 -0
- package/lib-vendor/d3-color/src/index.js +59 -0
- package/lib-vendor/d3-color/src/lab.js +117 -0
- package/lib-vendor/d3-color/src/math.js +8 -0
- package/lib-vendor/d3-delaunay/LICENSE +14 -0
- package/lib-vendor/d3-delaunay/dist/d3-delaunay.js +1398 -0
- package/lib-vendor/d3-delaunay/dist/d3-delaunay.min.js +853 -0
- package/lib-vendor/d3-delaunay/src/delaunay.js +282 -0
- package/lib-vendor/d3-delaunay/src/index.js +20 -0
- package/lib-vendor/d3-delaunay/src/path.js +43 -0
- package/lib-vendor/d3-delaunay/src/polygon.js +24 -0
- package/lib-vendor/d3-delaunay/src/voronoi.js +390 -0
- package/lib-vendor/d3-format/LICENSE +13 -0
- package/lib-vendor/d3-format/dist/d3-format.js +313 -0
- package/lib-vendor/d3-format/dist/d3-format.min.js +193 -0
- package/lib-vendor/d3-format/src/defaultLocale.js +23 -0
- package/lib-vendor/d3-format/src/exponent.js +10 -0
- package/lib-vendor/d3-format/src/formatDecimal.js +23 -0
- package/lib-vendor/d3-format/src/formatGroup.js +22 -0
- package/lib-vendor/d3-format/src/formatNumerals.js +13 -0
- package/lib-vendor/d3-format/src/formatPrefixAuto.js +18 -0
- package/lib-vendor/d3-format/src/formatRounded.js +14 -0
- package/lib-vendor/d3-format/src/formatSpecifier.js +42 -0
- package/lib-vendor/d3-format/src/formatTrim.js +25 -0
- package/lib-vendor/d3-format/src/formatTypes.js +25 -0
- package/lib-vendor/d3-format/src/identity.js +9 -0
- package/lib-vendor/d3-format/src/index.js +68 -0
- package/lib-vendor/d3-format/src/locale.js +152 -0
- package/lib-vendor/d3-format/src/precisionFixed.js +11 -0
- package/lib-vendor/d3-format/src/precisionPrefix.js +11 -0
- package/lib-vendor/d3-format/src/precisionRound.js +12 -0
- package/lib-vendor/d3-interpolate/LICENSE +13 -0
- package/lib-vendor/d3-interpolate/dist/d3-interpolate.js +543 -0
- package/lib-vendor/d3-interpolate/dist/d3-interpolate.min.js +362 -0
- package/lib-vendor/d3-interpolate/src/array.js +28 -0
- package/lib-vendor/d3-interpolate/src/basis.js +23 -0
- package/lib-vendor/d3-interpolate/src/basisClosed.js +18 -0
- package/lib-vendor/d3-interpolate/src/color.js +33 -0
- package/lib-vendor/d3-interpolate/src/constant.js +8 -0
- package/lib-vendor/d3-interpolate/src/cubehelix.js +32 -0
- package/lib-vendor/d3-interpolate/src/date.js +12 -0
- package/lib-vendor/d3-interpolate/src/discrete.js +12 -0
- package/lib-vendor/d3-interpolate/src/hcl.js +27 -0
- package/lib-vendor/d3-interpolate/src/hsl.js +27 -0
- package/lib-vendor/d3-interpolate/src/hue.js +14 -0
- package/lib-vendor/d3-interpolate/src/index.js +191 -0
- package/lib-vendor/d3-interpolate/src/lab.js +22 -0
- package/lib-vendor/d3-interpolate/src/number.js +11 -0
- package/lib-vendor/d3-interpolate/src/numberArray.js +20 -0
- package/lib-vendor/d3-interpolate/src/object.js +26 -0
- package/lib-vendor/d3-interpolate/src/piecewise.js +20 -0
- package/lib-vendor/d3-interpolate/src/quantize.js +11 -0
- package/lib-vendor/d3-interpolate/src/rgb.js +59 -0
- package/lib-vendor/d3-interpolate/src/round.js +11 -0
- package/lib-vendor/d3-interpolate/src/string.js +75 -0
- package/lib-vendor/d3-interpolate/src/transform/decompose.js +31 -0
- package/lib-vendor/d3-interpolate/src/transform/index.js +83 -0
- package/lib-vendor/d3-interpolate/src/transform/parse.js +25 -0
- package/lib-vendor/d3-interpolate/src/value.js +23 -0
- package/lib-vendor/d3-interpolate/src/zoom.js +66 -0
- package/lib-vendor/d3-path/LICENSE +13 -0
- package/lib-vendor/d3-path/dist/d3-path.js +161 -0
- package/lib-vendor/d3-path/dist/d3-path.min.js +92 -0
- package/lib-vendor/d3-path/src/index.js +24 -0
- package/lib-vendor/d3-path/src/path.js +158 -0
- package/lib-vendor/d3-scale/LICENSE +13 -0
- package/lib-vendor/d3-scale/dist/d3-scale.js +944 -0
- package/lib-vendor/d3-scale/dist/d3-scale.min.js +690 -0
- package/lib-vendor/d3-scale/src/band.js +87 -0
- package/lib-vendor/d3-scale/src/colors.js +11 -0
- package/lib-vendor/d3-scale/src/constant.js +11 -0
- package/lib-vendor/d3-scale/src/continuous.js +116 -0
- package/lib-vendor/d3-scale/src/diverging.js +91 -0
- package/lib-vendor/d3-scale/src/identity.js +27 -0
- package/lib-vendor/d3-scale/src/index.js +193 -0
- package/lib-vendor/d3-scale/src/init.js +38 -0
- package/lib-vendor/d3-scale/src/linear.js +67 -0
- package/lib-vendor/d3-scale/src/log.js +123 -0
- package/lib-vendor/d3-scale/src/nice.js +21 -0
- package/lib-vendor/d3-scale/src/number.js +9 -0
- package/lib-vendor/d3-scale/src/ordinal.js +44 -0
- package/lib-vendor/d3-scale/src/pow.js +44 -0
- package/lib-vendor/d3-scale/src/quantile.js +48 -0
- package/lib-vendor/d3-scale/src/quantize.js +46 -0
- package/lib-vendor/d3-scale/src/radial.js +53 -0
- package/lib-vendor/d3-scale/src/sequential.js +90 -0
- package/lib-vendor/d3-scale/src/sequentialQuantile.js +38 -0
- package/lib-vendor/d3-scale/src/symlog.js +35 -0
- package/lib-vendor/d3-scale/src/threshold.js +34 -0
- package/lib-vendor/d3-scale/src/tickFormat.js +37 -0
- package/lib-vendor/d3-scale/src/time.js +62 -0
- package/lib-vendor/d3-scale/src/utcTime.js +13 -0
- package/lib-vendor/d3-shape/LICENSE +13 -0
- package/lib-vendor/d3-shape/dist/d3-shape.js +2004 -0
- package/lib-vendor/d3-shape/dist/d3-shape.min.js +1389 -0
- package/lib-vendor/d3-shape/src/arc.js +250 -0
- package/lib-vendor/d3-shape/src/area.js +98 -0
- package/lib-vendor/d3-shape/src/areaRadial.js +42 -0
- package/lib-vendor/d3-shape/src/array.js +12 -0
- package/lib-vendor/d3-shape/src/constant.js +11 -0
- package/lib-vendor/d3-shape/src/curve/basis.js +62 -0
- package/lib-vendor/d3-shape/src/curve/basisClosed.js +70 -0
- package/lib-vendor/d3-shape/src/curve/basisOpen.js +54 -0
- package/lib-vendor/d3-shape/src/curve/bump.js +81 -0
- package/lib-vendor/d3-shape/src/curve/bundle.js +50 -0
- package/lib-vendor/d3-shape/src/curve/cardinal.js +69 -0
- package/lib-vendor/d3-shape/src/curve/cardinalClosed.js +76 -0
- package/lib-vendor/d3-shape/src/curve/cardinalOpen.js +60 -0
- package/lib-vendor/d3-shape/src/curve/catmullRom.js +92 -0
- package/lib-vendor/d3-shape/src/curve/catmullRomClosed.js +83 -0
- package/lib-vendor/d3-shape/src/curve/catmullRomOpen.js +67 -0
- package/lib-vendor/d3-shape/src/curve/linear.js +42 -0
- package/lib-vendor/d3-shape/src/curve/linearClosed.js +28 -0
- package/lib-vendor/d3-shape/src/curve/monotone.js +121 -0
- package/lib-vendor/d3-shape/src/curve/natural.js +67 -0
- package/lib-vendor/d3-shape/src/curve/radial.js +37 -0
- package/lib-vendor/d3-shape/src/curve/step.js +63 -0
- package/lib-vendor/d3-shape/src/descending.js +9 -0
- package/lib-vendor/d3-shape/src/identity.js +9 -0
- package/lib-vendor/d3-shape/src/index.js +436 -0
- package/lib-vendor/d3-shape/src/line.js +52 -0
- package/lib-vendor/d3-shape/src/lineRadial.js +24 -0
- package/lib-vendor/d3-shape/src/link.js +70 -0
- package/lib-vendor/d3-shape/src/math.js +26 -0
- package/lib-vendor/d3-shape/src/noop.js +7 -0
- package/lib-vendor/d3-shape/src/offset/diverging.js +20 -0
- package/lib-vendor/d3-shape/src/offset/expand.js +16 -0
- package/lib-vendor/d3-shape/src/offset/none.js +15 -0
- package/lib-vendor/d3-shape/src/offset/silhouette.js +16 -0
- package/lib-vendor/d3-shape/src/offset/wiggle.js +30 -0
- package/lib-vendor/d3-shape/src/order/appearance.js +23 -0
- package/lib-vendor/d3-shape/src/order/ascending.js +23 -0
- package/lib-vendor/d3-shape/src/order/descending.js +11 -0
- package/lib-vendor/d3-shape/src/order/insideOut.js +31 -0
- package/lib-vendor/d3-shape/src/order/none.js +12 -0
- package/lib-vendor/d3-shape/src/order/reverse.js +11 -0
- package/lib-vendor/d3-shape/src/path.js +22 -0
- package/lib-vendor/d3-shape/src/pie.js +79 -0
- package/lib-vendor/d3-shape/src/point.js +13 -0
- package/lib-vendor/d3-shape/src/pointRadial.js +9 -0
- package/lib-vendor/d3-shape/src/stack.js +55 -0
- package/lib-vendor/d3-shape/src/symbol/asterisk.js +21 -0
- package/lib-vendor/d3-shape/src/symbol/circle.js +14 -0
- package/lib-vendor/d3-shape/src/symbol/cross.js +25 -0
- package/lib-vendor/d3-shape/src/symbol/diamond.js +20 -0
- package/lib-vendor/d3-shape/src/symbol/diamond2.js +17 -0
- package/lib-vendor/d3-shape/src/symbol/plus.js +16 -0
- package/lib-vendor/d3-shape/src/symbol/square.js +14 -0
- package/lib-vendor/d3-shape/src/symbol/square2.js +17 -0
- package/lib-vendor/d3-shape/src/symbol/star.js +28 -0
- package/lib-vendor/d3-shape/src/symbol/times.js +16 -0
- package/lib-vendor/d3-shape/src/symbol/triangle.js +17 -0
- package/lib-vendor/d3-shape/src/symbol/triangle2.js +19 -0
- package/lib-vendor/d3-shape/src/symbol/wye.js +32 -0
- package/lib-vendor/d3-shape/src/symbol.js +50 -0
- package/lib-vendor/d3-time/LICENSE +13 -0
- package/lib-vendor/d3-time/dist/d3-time.js +367 -0
- package/lib-vendor/d3-time/dist/d3-time.min.js +190 -0
- package/lib-vendor/d3-time/src/day.js +30 -0
- package/lib-vendor/d3-time/src/duration.js +13 -0
- package/lib-vendor/d3-time/src/hour.js +28 -0
- package/lib-vendor/d3-time/src/index.js +417 -0
- package/lib-vendor/d3-time/src/interval.js +61 -0
- package/lib-vendor/d3-time/src/millisecond.js +29 -0
- package/lib-vendor/d3-time/src/minute.js +28 -0
- package/lib-vendor/d3-time/src/month.js +29 -0
- package/lib-vendor/d3-time/src/second.js +18 -0
- package/lib-vendor/d3-time/src/ticks.js +41 -0
- package/lib-vendor/d3-time/src/week.js +56 -0
- package/lib-vendor/d3-time/src/year.js +51 -0
- package/lib-vendor/d3-time-format/LICENSE +13 -0
- package/lib-vendor/d3-time-format/dist/d3-time-format.js +648 -0
- package/lib-vendor/d3-time-format/dist/d3-time-format.min.js +528 -0
- package/lib-vendor/d3-time-format/src/defaultLocale.js +32 -0
- package/lib-vendor/d3-time-format/src/index.js +60 -0
- package/lib-vendor/d3-time-format/src/isoFormat.js +13 -0
- package/lib-vendor/d3-time-format/src/isoParse.js +14 -0
- package/lib-vendor/d3-time-format/src/locale.js +606 -0
- package/lib-vendor/delaunator/LICENSE +15 -0
- package/lib-vendor/delaunator/delaunator.js +688 -0
- package/lib-vendor/delaunator/delaunator.min.js +316 -0
- package/lib-vendor/delaunator/index.js +440 -0
- package/lib-vendor/internmap/LICENSE +13 -0
- package/lib-vendor/internmap/dist/internmap.js +93 -0
- package/lib-vendor/internmap/dist/internmap.min.js +81 -0
- package/lib-vendor/internmap/src/index.js +87 -0
- package/lib-vendor/robust-predicates/LICENSE +24 -0
- package/lib-vendor/robust-predicates/esm/incircle.js +667 -0
- package/lib-vendor/robust-predicates/esm/insphere.js +693 -0
- package/lib-vendor/robust-predicates/esm/orient2d.js +174 -0
- package/lib-vendor/robust-predicates/esm/orient3d.js +422 -0
- package/lib-vendor/robust-predicates/esm/util.js +147 -0
- package/lib-vendor/robust-predicates/index.js +57 -0
- package/lib-vendor/robust-predicates/umd/incircle.js +798 -0
- package/lib-vendor/robust-predicates/umd/incircle.min.js +170 -0
- package/lib-vendor/robust-predicates/umd/insphere.js +828 -0
- package/lib-vendor/robust-predicates/umd/insphere.min.js +223 -0
- package/lib-vendor/robust-predicates/umd/orient2d.js +260 -0
- package/lib-vendor/robust-predicates/umd/orient2d.min.js +69 -0
- package/lib-vendor/robust-predicates/umd/orient3d.js +550 -0
- package/lib-vendor/robust-predicates/umd/orient3d.min.js +133 -0
- package/lib-vendor/robust-predicates/umd/predicates.js +2073 -0
- package/lib-vendor/robust-predicates/umd/predicates.min.js +468 -0
- package/package.json +63 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _basis = require("./basis.js");
|
|
8
|
+
function Bundle(context, beta) {
|
|
9
|
+
this._basis = new _basis.Basis(context);
|
|
10
|
+
this._beta = beta;
|
|
11
|
+
}
|
|
12
|
+
Bundle.prototype = {
|
|
13
|
+
lineStart: function () {
|
|
14
|
+
this._x = [];
|
|
15
|
+
this._y = [];
|
|
16
|
+
this._basis.lineStart();
|
|
17
|
+
},
|
|
18
|
+
lineEnd: function () {
|
|
19
|
+
var x = this._x,
|
|
20
|
+
y = this._y,
|
|
21
|
+
j = x.length - 1;
|
|
22
|
+
if (j > 0) {
|
|
23
|
+
var x0 = x[0],
|
|
24
|
+
y0 = y[0],
|
|
25
|
+
dx = x[j] - x0,
|
|
26
|
+
dy = y[j] - y0,
|
|
27
|
+
i = -1,
|
|
28
|
+
t;
|
|
29
|
+
while (++i <= j) {
|
|
30
|
+
t = i / j;
|
|
31
|
+
this._basis.point(this._beta * x[i] + (1 - this._beta) * (x0 + t * dx), this._beta * y[i] + (1 - this._beta) * (y0 + t * dy));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
this._x = this._y = null;
|
|
35
|
+
this._basis.lineEnd();
|
|
36
|
+
},
|
|
37
|
+
point: function (x, y) {
|
|
38
|
+
this._x.push(+x);
|
|
39
|
+
this._y.push(+y);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var _default = exports.default = function custom(beta) {
|
|
43
|
+
function bundle(context) {
|
|
44
|
+
return beta === 1 ? new _basis.Basis(context) : new Bundle(context, beta);
|
|
45
|
+
}
|
|
46
|
+
bundle.beta = function (beta) {
|
|
47
|
+
return custom(+beta);
|
|
48
|
+
};
|
|
49
|
+
return bundle;
|
|
50
|
+
}(0.85);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Cardinal = Cardinal;
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
exports.point = point;
|
|
9
|
+
function point(that, x, y) {
|
|
10
|
+
that._context.bezierCurveTo(that._x1 + that._k * (that._x2 - that._x0), that._y1 + that._k * (that._y2 - that._y0), that._x2 + that._k * (that._x1 - x), that._y2 + that._k * (that._y1 - y), that._x2, that._y2);
|
|
11
|
+
}
|
|
12
|
+
function Cardinal(context, tension) {
|
|
13
|
+
this._context = context;
|
|
14
|
+
this._k = (1 - tension) / 6;
|
|
15
|
+
}
|
|
16
|
+
Cardinal.prototype = {
|
|
17
|
+
areaStart: function () {
|
|
18
|
+
this._line = 0;
|
|
19
|
+
},
|
|
20
|
+
areaEnd: function () {
|
|
21
|
+
this._line = NaN;
|
|
22
|
+
},
|
|
23
|
+
lineStart: function () {
|
|
24
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
|
|
25
|
+
this._point = 0;
|
|
26
|
+
},
|
|
27
|
+
lineEnd: function () {
|
|
28
|
+
switch (this._point) {
|
|
29
|
+
case 2:
|
|
30
|
+
this._context.lineTo(this._x2, this._y2);
|
|
31
|
+
break;
|
|
32
|
+
case 3:
|
|
33
|
+
point(this, this._x1, this._y1);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
|
|
37
|
+
this._line = 1 - this._line;
|
|
38
|
+
},
|
|
39
|
+
point: function (x, y) {
|
|
40
|
+
x = +x, y = +y;
|
|
41
|
+
switch (this._point) {
|
|
42
|
+
case 0:
|
|
43
|
+
this._point = 1;
|
|
44
|
+
this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
|
45
|
+
break;
|
|
46
|
+
case 1:
|
|
47
|
+
this._point = 2;
|
|
48
|
+
this._x1 = x, this._y1 = y;
|
|
49
|
+
break;
|
|
50
|
+
case 2:
|
|
51
|
+
this._point = 3;
|
|
52
|
+
// falls through
|
|
53
|
+
default:
|
|
54
|
+
point(this, x, y);
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
|
58
|
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var _default = exports.default = function custom(tension) {
|
|
62
|
+
function cardinal(context) {
|
|
63
|
+
return new Cardinal(context, tension);
|
|
64
|
+
}
|
|
65
|
+
cardinal.tension = function (tension) {
|
|
66
|
+
return custom(+tension);
|
|
67
|
+
};
|
|
68
|
+
return cardinal;
|
|
69
|
+
}(0);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.CardinalClosed = CardinalClosed;
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _noop = _interopRequireDefault(require("../noop.js"));
|
|
10
|
+
var _cardinal = require("./cardinal.js");
|
|
11
|
+
function CardinalClosed(context, tension) {
|
|
12
|
+
this._context = context;
|
|
13
|
+
this._k = (1 - tension) / 6;
|
|
14
|
+
}
|
|
15
|
+
CardinalClosed.prototype = {
|
|
16
|
+
areaStart: _noop.default,
|
|
17
|
+
areaEnd: _noop.default,
|
|
18
|
+
lineStart: function () {
|
|
19
|
+
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
|
|
20
|
+
this._point = 0;
|
|
21
|
+
},
|
|
22
|
+
lineEnd: function () {
|
|
23
|
+
switch (this._point) {
|
|
24
|
+
case 1:
|
|
25
|
+
{
|
|
26
|
+
this._context.moveTo(this._x3, this._y3);
|
|
27
|
+
this._context.closePath();
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case 2:
|
|
31
|
+
{
|
|
32
|
+
this._context.lineTo(this._x3, this._y3);
|
|
33
|
+
this._context.closePath();
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case 3:
|
|
37
|
+
{
|
|
38
|
+
this.point(this._x3, this._y3);
|
|
39
|
+
this.point(this._x4, this._y4);
|
|
40
|
+
this.point(this._x5, this._y5);
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
point: function (x, y) {
|
|
46
|
+
x = +x, y = +y;
|
|
47
|
+
switch (this._point) {
|
|
48
|
+
case 0:
|
|
49
|
+
this._point = 1;
|
|
50
|
+
this._x3 = x, this._y3 = y;
|
|
51
|
+
break;
|
|
52
|
+
case 1:
|
|
53
|
+
this._point = 2;
|
|
54
|
+
this._context.moveTo(this._x4 = x, this._y4 = y);
|
|
55
|
+
break;
|
|
56
|
+
case 2:
|
|
57
|
+
this._point = 3;
|
|
58
|
+
this._x5 = x, this._y5 = y;
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
(0, _cardinal.point)(this, x, y);
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
|
65
|
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var _default = exports.default = function custom(tension) {
|
|
69
|
+
function cardinal(context) {
|
|
70
|
+
return new CardinalClosed(context, tension);
|
|
71
|
+
}
|
|
72
|
+
cardinal.tension = function (tension) {
|
|
73
|
+
return custom(+tension);
|
|
74
|
+
};
|
|
75
|
+
return cardinal;
|
|
76
|
+
}(0);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CardinalOpen = CardinalOpen;
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _cardinal = require("./cardinal.js");
|
|
9
|
+
function CardinalOpen(context, tension) {
|
|
10
|
+
this._context = context;
|
|
11
|
+
this._k = (1 - tension) / 6;
|
|
12
|
+
}
|
|
13
|
+
CardinalOpen.prototype = {
|
|
14
|
+
areaStart: function () {
|
|
15
|
+
this._line = 0;
|
|
16
|
+
},
|
|
17
|
+
areaEnd: function () {
|
|
18
|
+
this._line = NaN;
|
|
19
|
+
},
|
|
20
|
+
lineStart: function () {
|
|
21
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
|
|
22
|
+
this._point = 0;
|
|
23
|
+
},
|
|
24
|
+
lineEnd: function () {
|
|
25
|
+
if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();
|
|
26
|
+
this._line = 1 - this._line;
|
|
27
|
+
},
|
|
28
|
+
point: function (x, y) {
|
|
29
|
+
x = +x, y = +y;
|
|
30
|
+
switch (this._point) {
|
|
31
|
+
case 0:
|
|
32
|
+
this._point = 1;
|
|
33
|
+
break;
|
|
34
|
+
case 1:
|
|
35
|
+
this._point = 2;
|
|
36
|
+
break;
|
|
37
|
+
case 2:
|
|
38
|
+
this._point = 3;
|
|
39
|
+
this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
|
|
40
|
+
break;
|
|
41
|
+
case 3:
|
|
42
|
+
this._point = 4;
|
|
43
|
+
// falls through
|
|
44
|
+
default:
|
|
45
|
+
(0, _cardinal.point)(this, x, y);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
|
49
|
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var _default = exports.default = function custom(tension) {
|
|
53
|
+
function cardinal(context) {
|
|
54
|
+
return new CardinalOpen(context, tension);
|
|
55
|
+
}
|
|
56
|
+
cardinal.tension = function (tension) {
|
|
57
|
+
return custom(+tension);
|
|
58
|
+
};
|
|
59
|
+
return cardinal;
|
|
60
|
+
}(0);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.point = point;
|
|
8
|
+
var _math = require("../math.js");
|
|
9
|
+
var _cardinal = require("./cardinal.js");
|
|
10
|
+
function point(that, x, y) {
|
|
11
|
+
var x1 = that._x1,
|
|
12
|
+
y1 = that._y1,
|
|
13
|
+
x2 = that._x2,
|
|
14
|
+
y2 = that._y2;
|
|
15
|
+
if (that._l01_a > _math.epsilon) {
|
|
16
|
+
var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,
|
|
17
|
+
n = 3 * that._l01_a * (that._l01_a + that._l12_a);
|
|
18
|
+
x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;
|
|
19
|
+
y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;
|
|
20
|
+
}
|
|
21
|
+
if (that._l23_a > _math.epsilon) {
|
|
22
|
+
var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,
|
|
23
|
+
m = 3 * that._l23_a * (that._l23_a + that._l12_a);
|
|
24
|
+
x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;
|
|
25
|
+
y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;
|
|
26
|
+
}
|
|
27
|
+
that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);
|
|
28
|
+
}
|
|
29
|
+
function CatmullRom(context, alpha) {
|
|
30
|
+
this._context = context;
|
|
31
|
+
this._alpha = alpha;
|
|
32
|
+
}
|
|
33
|
+
CatmullRom.prototype = {
|
|
34
|
+
areaStart: function () {
|
|
35
|
+
this._line = 0;
|
|
36
|
+
},
|
|
37
|
+
areaEnd: function () {
|
|
38
|
+
this._line = NaN;
|
|
39
|
+
},
|
|
40
|
+
lineStart: function () {
|
|
41
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
|
|
42
|
+
this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
43
|
+
},
|
|
44
|
+
lineEnd: function () {
|
|
45
|
+
switch (this._point) {
|
|
46
|
+
case 2:
|
|
47
|
+
this._context.lineTo(this._x2, this._y2);
|
|
48
|
+
break;
|
|
49
|
+
case 3:
|
|
50
|
+
this.point(this._x2, this._y2);
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
|
|
54
|
+
this._line = 1 - this._line;
|
|
55
|
+
},
|
|
56
|
+
point: function (x, y) {
|
|
57
|
+
x = +x, y = +y;
|
|
58
|
+
if (this._point) {
|
|
59
|
+
var x23 = this._x2 - x,
|
|
60
|
+
y23 = this._y2 - y;
|
|
61
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
|
62
|
+
}
|
|
63
|
+
switch (this._point) {
|
|
64
|
+
case 0:
|
|
65
|
+
this._point = 1;
|
|
66
|
+
this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
|
67
|
+
break;
|
|
68
|
+
case 1:
|
|
69
|
+
this._point = 2;
|
|
70
|
+
break;
|
|
71
|
+
case 2:
|
|
72
|
+
this._point = 3;
|
|
73
|
+
// falls through
|
|
74
|
+
default:
|
|
75
|
+
point(this, x, y);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a;
|
|
79
|
+
this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
|
|
80
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
|
81
|
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var _default = exports.default = function custom(alpha) {
|
|
85
|
+
function catmullRom(context) {
|
|
86
|
+
return alpha ? new CatmullRom(context, alpha) : new _cardinal.Cardinal(context, 0);
|
|
87
|
+
}
|
|
88
|
+
catmullRom.alpha = function (alpha) {
|
|
89
|
+
return custom(+alpha);
|
|
90
|
+
};
|
|
91
|
+
return catmullRom;
|
|
92
|
+
}(0.5);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _cardinalClosed = require("./cardinalClosed.js");
|
|
9
|
+
var _noop = _interopRequireDefault(require("../noop.js"));
|
|
10
|
+
var _catmullRom = require("./catmullRom.js");
|
|
11
|
+
function CatmullRomClosed(context, alpha) {
|
|
12
|
+
this._context = context;
|
|
13
|
+
this._alpha = alpha;
|
|
14
|
+
}
|
|
15
|
+
CatmullRomClosed.prototype = {
|
|
16
|
+
areaStart: _noop.default,
|
|
17
|
+
areaEnd: _noop.default,
|
|
18
|
+
lineStart: function () {
|
|
19
|
+
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
|
|
20
|
+
this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
21
|
+
},
|
|
22
|
+
lineEnd: function () {
|
|
23
|
+
switch (this._point) {
|
|
24
|
+
case 1:
|
|
25
|
+
{
|
|
26
|
+
this._context.moveTo(this._x3, this._y3);
|
|
27
|
+
this._context.closePath();
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case 2:
|
|
31
|
+
{
|
|
32
|
+
this._context.lineTo(this._x3, this._y3);
|
|
33
|
+
this._context.closePath();
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case 3:
|
|
37
|
+
{
|
|
38
|
+
this.point(this._x3, this._y3);
|
|
39
|
+
this.point(this._x4, this._y4);
|
|
40
|
+
this.point(this._x5, this._y5);
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
point: function (x, y) {
|
|
46
|
+
x = +x, y = +y;
|
|
47
|
+
if (this._point) {
|
|
48
|
+
var x23 = this._x2 - x,
|
|
49
|
+
y23 = this._y2 - y;
|
|
50
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
|
51
|
+
}
|
|
52
|
+
switch (this._point) {
|
|
53
|
+
case 0:
|
|
54
|
+
this._point = 1;
|
|
55
|
+
this._x3 = x, this._y3 = y;
|
|
56
|
+
break;
|
|
57
|
+
case 1:
|
|
58
|
+
this._point = 2;
|
|
59
|
+
this._context.moveTo(this._x4 = x, this._y4 = y);
|
|
60
|
+
break;
|
|
61
|
+
case 2:
|
|
62
|
+
this._point = 3;
|
|
63
|
+
this._x5 = x, this._y5 = y;
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
(0, _catmullRom.point)(this, x, y);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a;
|
|
70
|
+
this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
|
|
71
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
|
72
|
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var _default = exports.default = function custom(alpha) {
|
|
76
|
+
function catmullRom(context) {
|
|
77
|
+
return alpha ? new CatmullRomClosed(context, alpha) : new _cardinalClosed.CardinalClosed(context, 0);
|
|
78
|
+
}
|
|
79
|
+
catmullRom.alpha = function (alpha) {
|
|
80
|
+
return custom(+alpha);
|
|
81
|
+
};
|
|
82
|
+
return catmullRom;
|
|
83
|
+
}(0.5);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _cardinalOpen = require("./cardinalOpen.js");
|
|
8
|
+
var _catmullRom = require("./catmullRom.js");
|
|
9
|
+
function CatmullRomOpen(context, alpha) {
|
|
10
|
+
this._context = context;
|
|
11
|
+
this._alpha = alpha;
|
|
12
|
+
}
|
|
13
|
+
CatmullRomOpen.prototype = {
|
|
14
|
+
areaStart: function () {
|
|
15
|
+
this._line = 0;
|
|
16
|
+
},
|
|
17
|
+
areaEnd: function () {
|
|
18
|
+
this._line = NaN;
|
|
19
|
+
},
|
|
20
|
+
lineStart: function () {
|
|
21
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
|
|
22
|
+
this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
23
|
+
},
|
|
24
|
+
lineEnd: function () {
|
|
25
|
+
if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();
|
|
26
|
+
this._line = 1 - this._line;
|
|
27
|
+
},
|
|
28
|
+
point: function (x, y) {
|
|
29
|
+
x = +x, y = +y;
|
|
30
|
+
if (this._point) {
|
|
31
|
+
var x23 = this._x2 - x,
|
|
32
|
+
y23 = this._y2 - y;
|
|
33
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
|
34
|
+
}
|
|
35
|
+
switch (this._point) {
|
|
36
|
+
case 0:
|
|
37
|
+
this._point = 1;
|
|
38
|
+
break;
|
|
39
|
+
case 1:
|
|
40
|
+
this._point = 2;
|
|
41
|
+
break;
|
|
42
|
+
case 2:
|
|
43
|
+
this._point = 3;
|
|
44
|
+
this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
|
|
45
|
+
break;
|
|
46
|
+
case 3:
|
|
47
|
+
this._point = 4;
|
|
48
|
+
// falls through
|
|
49
|
+
default:
|
|
50
|
+
(0, _catmullRom.point)(this, x, y);
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a;
|
|
54
|
+
this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
|
|
55
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
|
56
|
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var _default = exports.default = function custom(alpha) {
|
|
60
|
+
function catmullRom(context) {
|
|
61
|
+
return alpha ? new CatmullRomOpen(context, alpha) : new _cardinalOpen.CardinalOpen(context, 0);
|
|
62
|
+
}
|
|
63
|
+
catmullRom.alpha = function (alpha) {
|
|
64
|
+
return custom(+alpha);
|
|
65
|
+
};
|
|
66
|
+
return catmullRom;
|
|
67
|
+
}(0.5);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
function Linear(context) {
|
|
8
|
+
this._context = context;
|
|
9
|
+
}
|
|
10
|
+
Linear.prototype = {
|
|
11
|
+
areaStart: function () {
|
|
12
|
+
this._line = 0;
|
|
13
|
+
},
|
|
14
|
+
areaEnd: function () {
|
|
15
|
+
this._line = NaN;
|
|
16
|
+
},
|
|
17
|
+
lineStart: function () {
|
|
18
|
+
this._point = 0;
|
|
19
|
+
},
|
|
20
|
+
lineEnd: function () {
|
|
21
|
+
if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
|
|
22
|
+
this._line = 1 - this._line;
|
|
23
|
+
},
|
|
24
|
+
point: function (x, y) {
|
|
25
|
+
x = +x, y = +y;
|
|
26
|
+
switch (this._point) {
|
|
27
|
+
case 0:
|
|
28
|
+
this._point = 1;
|
|
29
|
+
this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
|
30
|
+
break;
|
|
31
|
+
case 1:
|
|
32
|
+
this._point = 2;
|
|
33
|
+
// falls through
|
|
34
|
+
default:
|
|
35
|
+
this._context.lineTo(x, y);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
function _default(context) {
|
|
41
|
+
return new Linear(context);
|
|
42
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = _default;
|
|
8
|
+
var _noop = _interopRequireDefault(require("../noop.js"));
|
|
9
|
+
function LinearClosed(context) {
|
|
10
|
+
this._context = context;
|
|
11
|
+
}
|
|
12
|
+
LinearClosed.prototype = {
|
|
13
|
+
areaStart: _noop.default,
|
|
14
|
+
areaEnd: _noop.default,
|
|
15
|
+
lineStart: function () {
|
|
16
|
+
this._point = 0;
|
|
17
|
+
},
|
|
18
|
+
lineEnd: function () {
|
|
19
|
+
if (this._point) this._context.closePath();
|
|
20
|
+
},
|
|
21
|
+
point: function (x, y) {
|
|
22
|
+
x = +x, y = +y;
|
|
23
|
+
if (this._point) this._context.lineTo(x, y);else this._point = 1, this._context.moveTo(x, y);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
function _default(context) {
|
|
27
|
+
return new LinearClosed(context);
|
|
28
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.monotoneX = monotoneX;
|
|
7
|
+
exports.monotoneY = monotoneY;
|
|
8
|
+
function sign(x) {
|
|
9
|
+
return x < 0 ? -1 : 1;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Calculate the slopes of the tangents (Hermite-type interpolation) based on
|
|
13
|
+
// the following paper: Steffen, M. 1990. A Simple Method for Monotonic
|
|
14
|
+
// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.
|
|
15
|
+
// NOV(II), P. 443, 1990.
|
|
16
|
+
function slope3(that, x2, y2) {
|
|
17
|
+
var h0 = that._x1 - that._x0,
|
|
18
|
+
h1 = x2 - that._x1,
|
|
19
|
+
s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),
|
|
20
|
+
s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),
|
|
21
|
+
p = (s0 * h1 + s1 * h0) / (h0 + h1);
|
|
22
|
+
return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Calculate a one-sided slope.
|
|
26
|
+
function slope2(that, t) {
|
|
27
|
+
var h = that._x1 - that._x0;
|
|
28
|
+
return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations
|
|
32
|
+
// "you can express cubic Hermite interpolation in terms of cubic Bézier curves
|
|
33
|
+
// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1".
|
|
34
|
+
function point(that, t0, t1) {
|
|
35
|
+
var x0 = that._x0,
|
|
36
|
+
y0 = that._y0,
|
|
37
|
+
x1 = that._x1,
|
|
38
|
+
y1 = that._y1,
|
|
39
|
+
dx = (x1 - x0) / 3;
|
|
40
|
+
that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);
|
|
41
|
+
}
|
|
42
|
+
function MonotoneX(context) {
|
|
43
|
+
this._context = context;
|
|
44
|
+
}
|
|
45
|
+
MonotoneX.prototype = {
|
|
46
|
+
areaStart: function () {
|
|
47
|
+
this._line = 0;
|
|
48
|
+
},
|
|
49
|
+
areaEnd: function () {
|
|
50
|
+
this._line = NaN;
|
|
51
|
+
},
|
|
52
|
+
lineStart: function () {
|
|
53
|
+
this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN;
|
|
54
|
+
this._point = 0;
|
|
55
|
+
},
|
|
56
|
+
lineEnd: function () {
|
|
57
|
+
switch (this._point) {
|
|
58
|
+
case 2:
|
|
59
|
+
this._context.lineTo(this._x1, this._y1);
|
|
60
|
+
break;
|
|
61
|
+
case 3:
|
|
62
|
+
point(this, this._t0, slope2(this, this._t0));
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
|
|
66
|
+
this._line = 1 - this._line;
|
|
67
|
+
},
|
|
68
|
+
point: function (x, y) {
|
|
69
|
+
var t1 = NaN;
|
|
70
|
+
x = +x, y = +y;
|
|
71
|
+
if (x === this._x1 && y === this._y1) return; // Ignore coincident points.
|
|
72
|
+
switch (this._point) {
|
|
73
|
+
case 0:
|
|
74
|
+
this._point = 1;
|
|
75
|
+
this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
|
76
|
+
break;
|
|
77
|
+
case 1:
|
|
78
|
+
this._point = 2;
|
|
79
|
+
break;
|
|
80
|
+
case 2:
|
|
81
|
+
this._point = 3;
|
|
82
|
+
point(this, slope2(this, t1 = slope3(this, x, y)), t1);
|
|
83
|
+
break;
|
|
84
|
+
default:
|
|
85
|
+
point(this, this._t0, t1 = slope3(this, x, y));
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
this._x0 = this._x1, this._x1 = x;
|
|
89
|
+
this._y0 = this._y1, this._y1 = y;
|
|
90
|
+
this._t0 = t1;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
function MonotoneY(context) {
|
|
94
|
+
this._context = new ReflectContext(context);
|
|
95
|
+
}
|
|
96
|
+
(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function (x, y) {
|
|
97
|
+
MonotoneX.prototype.point.call(this, y, x);
|
|
98
|
+
};
|
|
99
|
+
function ReflectContext(context) {
|
|
100
|
+
this._context = context;
|
|
101
|
+
}
|
|
102
|
+
ReflectContext.prototype = {
|
|
103
|
+
moveTo: function (x, y) {
|
|
104
|
+
this._context.moveTo(y, x);
|
|
105
|
+
},
|
|
106
|
+
closePath: function () {
|
|
107
|
+
this._context.closePath();
|
|
108
|
+
},
|
|
109
|
+
lineTo: function (x, y) {
|
|
110
|
+
this._context.lineTo(y, x);
|
|
111
|
+
},
|
|
112
|
+
bezierCurveTo: function (x1, y1, x2, y2, x, y) {
|
|
113
|
+
this._context.bezierCurveTo(y1, x1, y2, x2, y, x);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
function monotoneX(context) {
|
|
117
|
+
return new MonotoneX(context);
|
|
118
|
+
}
|
|
119
|
+
function monotoneY(context) {
|
|
120
|
+
return new MonotoneY(context);
|
|
121
|
+
}
|