From ded5795ebe9e3993dc1870cc491623bad74cf490 Mon Sep 17 00:00:00 2001 From: Joost De Cock Date: Tue, 16 Jul 2019 16:18:07 +0200 Subject: [PATCH] :sparkles: Added the path.setRender() method to core --- packages/core/src/path.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/core/src/path.js b/packages/core/src/path.js index 3e81e49c5ff..39f4e12b049 100644 --- a/packages/core/src/path.js +++ b/packages/core/src/path.js @@ -19,6 +19,14 @@ function Path() { this.ops = []; } +/** Chainable way to set the render property */ +Path.prototype.setRender = function(render = true) { + if (render) this.render = true; + else this.render = false; + + return this; +}; + /** Adds a move operation to Point to */ Path.prototype.move = function(to) { this.ops.push({ type: "move", to }); @@ -83,9 +91,7 @@ Path.prototype.asPathstring = function() { d += ` L ${op.to.x},${op.to.y}`; break; case "curve": - d += ` C ${op.cp1.x},${op.cp1.y} ${op.cp2.x},${op.cp2.y} ${op.to.x},${ - op.to.y - }`; + d += ` C ${op.cp1.x},${op.cp1.y} ${op.cp2.x},${op.cp2.y} ${op.to.x},${op.to.y}`; break; case "close": d += " z";