Reputation: 442
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.
Upvotes: 2
Views: 2575
Reputation: 15604
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>
Upvotes: 9