Fabric.js示例:
http://jsfiddle.net/regsmile/jD7T4/58/
// how reset rotate with scale ? I dont' know
var itemS=new fabric.Rect();
itemS.set({originX:'left',originY:'top',width:50,height:50,left:145,top:135, fill: '#E14B17',hasControls:false,selectable:false,angle:30,scaleX:1.5});
canvas.add(itemS);
itemS.clipTo = function (ctx)
{
ctx.save();
// how reset rotate with scale ?
ctx.rotate((this.angle* -1) * (Math.PI / 180));
ctx.rect((-this.width/2),(-this.height/2),this.width,this.height);
ctx.restore();
ctx.stroke();
}
canvas.renderAll();
最后一项,保持缩放,但如何重置?