Merge pull request #41 from Janpot/fix-clip
.clip was not working, the path never made it to the clip area
This commit is contained in:
commit
92464d63b6
@ -1029,6 +1029,7 @@
|
||||
id = randomString(this.__ids),
|
||||
newGroup = this.__createElement("g");
|
||||
|
||||
this.__applyCurrentDefaultPath();
|
||||
group.removeChild(this.__currentElement);
|
||||
clipPath.setAttribute("id", id);
|
||||
clipPath.appendChild(this.__currentElement);
|
||||
|
@ -332,4 +332,16 @@ describe('canvas2svg', function() {
|
||||
expect(svg.querySelector("path").getAttribute("stroke-opacity")).to.equal(''+0.8*0.5);
|
||||
});
|
||||
});
|
||||
|
||||
describe("supports clip", function() {
|
||||
it("adds clippath", function() {
|
||||
var ctx = new C2S();
|
||||
ctx.rect(200, 200, 400, 400);
|
||||
ctx.clip();
|
||||
ctx.fillStyle = "#000000";
|
||||
ctx.rect(100, 100, 300, 300);
|
||||
var svg = ctx.getSvg();
|
||||
expect(svg.querySelector("clipPath > path").getAttribute("d")).to.not.equal(null);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user