diff --git a/CHANGELOG.md b/CHANGELOG.md index af4872aa2a5..ee56f992336 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # Changelog -## [next] +## [4.6.0] +- feat(fabric.util): added fabric.util.transformPath to add transformations to path points [#7300](https://github.com/fabricjs/fabric.js/pull/7300) +- feat(fabric.util): added fabric.util.joinPath, the opposite of fabric.util.parsePath [#7300](https://github.com/fabricjs/fabric.js/pull/7300) - fix(fabric.util): use integers iterators [#7233](https://github.com/fabricjs/fabric.js/pull/7233) - feat(fabric.Text) add path rendering to text on path [#7328](https://github.com/fabricjs/fabric.js/pull/7328) - feat(fabric.iText): Add optional hiddenTextareaContainer to contain hiddenTextarea [#7314](https://github.com/fabricjs/fabric.js/pull/7314) diff --git a/src/brushes/pencil_brush.class.js b/src/brushes/pencil_brush.class.js index 68c7c7f052a..59fa9c058e4 100644 --- a/src/brushes/pencil_brush.class.js +++ b/src/brushes/pencil_brush.class.js @@ -192,7 +192,7 @@ * @returns {boolean} */ _isEmptySVGPath: function (pathData) { - var pathString = pathData.map(function (segment) { return segment.join(' '); }).join(' '); + var pathString = fabric.util.joinPath(pathData); return pathString === 'M 0 0 Q 0 0 0 0 L 0 0'; }, diff --git a/src/shapes/path.class.js b/src/shapes/path.class.js index ab379e5b3cf..24ea8bf63dc 100644 --- a/src/shapes/path.class.js +++ b/src/shapes/path.class.js @@ -56,12 +56,9 @@ var fromArray = _toString.call(path) === '[object Array]'; - this.path = fromArray - ? fabric.util.makePathSimpler(path) - - : fabric.util.makePathSimpler( - fabric.util.parsePath(path) - ); + this.path = fabric.util.makePathSimpler( + fromArray ? path : fabric.util.parsePath(path) + ); if (!this.path) { return; @@ -193,9 +190,7 @@ * of the instance */ _toSVG: function() { - var path = this.path.map(function(path) { - return path.join(' '); - }).join(' '); + var path = fabric.util.joinPath(this.path); return [ '