I want to get the real object width and height while I am scaling the object. I tried with
canvas.on('object:scaling', function(e){
console.log(e.target.width*e.target.scaleX);
});
But seem that does not work properly.
Use object.getScaledWidth().
DEMO
var canvas = new fabric.Canvas("c");
var circle = new fabric.Circle({radius:100})
canvas.add(circle);
circle.on('scaling',function(){
console.log(parseInt(this.getScaledWidth()))
})
canvas{
border: 1px dotted green;
}
<script src="https://rawgit.com/kangax/fabric.js/master/dist/fabric.js"></script>
<canvas id="c" width=400 height=400></canvas>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With