问题
I have a codepen http://codepen.io/artzub/pen/oXaVpz, which demonstrates how to use the clip method of Canvas with images.
// some code before
// ...
l = nodes.length;
ctx.save();
while(l--) {
item = nodes[l];
ctx.beginPath();
ctx.arc(item.x, item.y, 30, 0, 2*Math.PI);
ctx.closePath();
ctx.stroke();
ctx.fill();
if (groupImg[item.group]) {
ctx.save();
ctx.clip();
ctx.drawImage(groupImg[item.group], item.x - 30, item.y - 30, 60, 60);
ctx.restore();
}
}
ctx.restore();
But into the last versions of Chrome it does not work correct.
Do you have ideas why it is and how does it fix?
Also it works correct in Firefox.
来源:https://stackoverflow.com/questions/36756073/why-does-the-clip-method-work-wrong-into-last-versions-of-chrome