如何lockscaleX
和lockscaleY
但允许uniscaling
Fabric.js中的对象?这是我试过的:
if (shape.scaleX != 1 && shape.scaleY != 1) {
shape.width = shape.scaleX * shape.width;
shape.height = shape.scaleY * shape.height;
shape.scaleX = 1;
shape.scaleY = 1;
} else {
shape.scaleX = 1;
shape.scaleY = 1;
}
答案 0 :(得分:2)
这很简单:
object.lockUniScaling = true;