Merge pull request #22 from zenozeng/lineto-pr

when lineTo called, use M instead of L unless subpath exists
This commit is contained in:
clintjd 2015-06-02 11:09:42 -07:00
commit 32b567c325

View File

@ -558,7 +558,11 @@
* Adds a line to command * Adds a line to command
*/ */
ctx.prototype.lineTo = function(x, y){ ctx.prototype.lineTo = function(x, y){
if (this.__currentDefaultPath.indexOf('M') > -1) {
this.__addPathCommand(format("L {x} {y}", {x:x, y:y})); this.__addPathCommand(format("L {x} {y}", {x:x, y:y}));
} else {
this.__addPathCommand(format("M {x} {y}", {x:x, y:y}));
}
}; };
/** /**