diff --git a/src/path/Curve.js b/src/path/Curve.js index 705195d1..51b7cf23 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -1009,8 +1009,10 @@ new function() { // Scope for methods that require numerical integration a = 0; if (b === undefined) b = 1; + var isZero = Numerical.isZero; // See if the curve is linear by checking p1 == c1 and p2 == c2 - if (v[0] == v[2] && v[1] == v[3] && v[6] == v[4] && v[7] == v[5]) { + if (isZero(v[0] - v[2]) && isZero(v[1] - v[3]) + && isZero(v[6] - v[4]) && isZero(v[7] - v[5])) { // Straight line var dx = v[6] - v[0], // p2x - p1x dy = v[7] - v[1]; // p2y - p1y diff --git a/test/tests/Path_Curves.js b/test/tests/Path_Curves.js index 3e3ed49d..e9c512e4 100644 --- a/test/tests/Path_Curves.js +++ b/test/tests/Path_Curves.js @@ -39,7 +39,7 @@ test('path.curves synchronisation', function() { var length = path.curves[0].length; ok(path.curves[0]._length, 'Curve length does not appear to be cached'); path.scale(2, [0, 0]); - equals(path.curves[0].length, 200, 'Curve length should be updated when path is transformed'); + compareNumbers(path.curves[0].length, 200, 'Curve length should be updated when path is transformed'); var points = []; for (var i = 0; i < 40; i++)