when lineTo called, use M instead of L unless subpath exists

This commit is contained in:
Zeno Zeng 2015-05-29 23:32:15 +08:00
parent a186bb9a95
commit f5b2692a88

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){
this.__addPathCommand(format("L {x} {y}", {x:x, y:y})); if (this.__currentDefaultPath.indexOf('M') > -1) {
this.__addPathCommand(format("L {x} {y}", {x:x, y:y}));
} else {
this.__addPathCommand(format("M {x} {y}", {x:x, y:y}));
}
}; };
/** /**