We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 97f6a50 commit b339f8aCopy full SHA for b339f8a
1 file changed
src/path.js
@@ -23,26 +23,21 @@ function appendRound(digits) {
23
};
24
}
25
26
-function round(digits) {
27
- const k = 10 ** digits;
28
- return function(value) {
29
- return Math.round(value * k) / k;
30
- };
31
-}
32
-
33
function equal(x0, y0, x1, y1) {
34
return x0 === x1 && y0 === y1;
35
36
37
function equalRound(digits) {
38
- let d = Math.floor(digits);
+ const d = Math.floor(digits);
39
if (d > 15) return equal;
40
- const r = round(digits);
+ const k = 10 ** d;
+ const r = function(value) {
+ return Math.round(value * k);
+ };
41
return function(x0, y0, x1, y1) {
42
return r(x0) === r(x1) && r(y0) === r(y1);
43
44
45
46
export class Path {
47
constructor(digits) {
48
this._x0 = this._y0 = // start of current subpath
0 commit comments