Need to stretch background image to cover whole canvas in fabricjs
I can load the background image. but I am not shying away from how to stretch the whole canvas. sample code
var fr = new FileReader;
fr.onload = function() {
var image = new Image();
image.onload = function() {
var imgwidth = this.width;
currentcanvas.setBackgroundImage(fr.result, currentcanvas.renderAll.bind(currentcanvas), {
scaleX: currentcanvas.width / imgwidth,
scaleY: currentcanvas.height / imgwidth
});
currentcanvas.renderAll();
};
+3
source to share
2 answers