旋转后移动画布图像对象

时间:2015-09-22 09:21:05

标签: javascript canvas fabricjs

旋转画布后的图像被裁剪。如何将图像调整为画布大小?

$("#rotate").click(function(){
var curAngle = canvas.item(0).getAngle();
if(curAngle == 360)
    curAngle = 0
if(curAngle == 0 || curAngle == 180){
    canvas.setHeight(200);
    canvas.setWidth(400);
}
if(curAngle == 90 || curAngle == 270){
    canvas.setHeight(400);
    canvas.setWidth(200);   
}

canvas.item(0).setAngle(curAngle+90);

canvas.renderAll();
});

http://jsfiddle.net/3efe2x9j/21/

0 个答案:

没有答案