✨ Added the path.setRender() method to core
This commit is contained in:
parent
6a461e0ee9
commit
ded5795ebe
1 changed files with 9 additions and 3 deletions
|
@ -19,6 +19,14 @@ function Path() {
|
||||||
this.ops = [];
|
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 */
|
/** Adds a move operation to Point to */
|
||||||
Path.prototype.move = function(to) {
|
Path.prototype.move = function(to) {
|
||||||
this.ops.push({ type: "move", to });
|
this.ops.push({ type: "move", to });
|
||||||
|
@ -83,9 +91,7 @@ Path.prototype.asPathstring = function() {
|
||||||
d += ` L ${op.to.x},${op.to.y}`;
|
d += ` L ${op.to.x},${op.to.y}`;
|
||||||
break;
|
break;
|
||||||
case "curve":
|
case "curve":
|
||||||
d += ` C ${op.cp1.x},${op.cp1.y} ${op.cp2.x},${op.cp2.y} ${op.to.x},${
|
d += ` C ${op.cp1.x},${op.cp1.y} ${op.cp2.x},${op.cp2.y} ${op.to.x},${op.to.y}`;
|
||||||
op.to.y
|
|
||||||
}`;
|
|
||||||
break;
|
break;
|
||||||
case "close":
|
case "close":
|
||||||
d += " z";
|
d += " z";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue