I am working in one image editor in which there are some facility : like set image as canvas background and add image object into canvas.
I am using fabric js version 1.7.22. and can't update right now.
Let me explain whole scenario :
First I set image as background by using following code :
canvas.setBackgroundImage("url", function() {
canvas.renderAll();
}, {
scaleX: canvas.getWidth() / image.originalWidth,
scaleY: canvas.getHeight() / image.originalHeight,
});
So the value of scale in above code is somthing like this :
scaleX: 0.1252875648597568542
scaleY: 0.149856546546546456545546
This is set perfect. but when I convert this canvas into json , then scale value is trimed in json. and when I load again that json into canvas, my image size is not perfect set into canvas background. because some value is trimed
Is there any patch that make json that contain same value as canvas elements contain.
Here is fiddle for demo of trim scale value in json. http://jsfiddle.net/Mark_1998/q9r20zgy/
Also, Please read comment in fiddle.
If any patch available for prevent trimming this value then Please mention here.