fixes #6
This commit is contained in:
parent
9d15a4770e
commit
ffc017bfe2
@ -1,5 +1,5 @@
|
||||
/*!!
|
||||
* Canvas 2 Svg v1.0.4
|
||||
* Canvas 2 Svg v1.0.5
|
||||
* A low level canvas to SVG converter. Uses a mock canvas context to build an SVG document.
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
@ -507,6 +507,9 @@
|
||||
* if the currentPathElement is not empty create a new path element
|
||||
*/
|
||||
ctx.prototype.moveTo = function(x,y){
|
||||
if(this.__currentElement.nodeName !== "path") {
|
||||
this.beginPath();
|
||||
}
|
||||
this.__addPathCommand(format("M {x} {y}", {x:x, y:y}));
|
||||
};
|
||||
|
||||
|
@ -38,11 +38,11 @@ describe("canvas2svg", function() {
|
||||
expect(ctx2.height).toEqual(400);
|
||||
expect(ctx2.enableMirroring).toEqual(false);
|
||||
|
||||
var ctx = C2S();
|
||||
expect(ctx instanceof C2S).toBe(true);
|
||||
expect(ctx.width).toEqual(500);
|
||||
expect(ctx.height).toEqual(500);
|
||||
expect(ctx.enableMirroring).toEqual(false);
|
||||
var ctx3 = C2S();
|
||||
expect(ctx3 instanceof C2S).toBe(true);
|
||||
expect(ctx3.width).toEqual(500);
|
||||
expect(ctx3.height).toEqual(500);
|
||||
expect(ctx3.enableMirroring).toEqual(false);
|
||||
|
||||
});
|
||||
|
||||
@ -155,4 +155,14 @@ describe("canvas2svg", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("supports path commands", function() {
|
||||
|
||||
it("and moveTo may be called without beginPath, but is not recommended", function() {
|
||||
var ctx = new C2S();
|
||||
ctx.moveTo(0,0);
|
||||
ctx.lineTo(100,100);
|
||||
ctx.stroke();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user