javascript - Multiple background images in fabricjs -
i building new app fabricjs, in need
user controlled multiple background images in behave normal image, user can rotate, drag resize it, done stuff multiple bg,
// 1st img var img = new image(); img.onload = function(){ canvas.setbackgroundimage(img.src, canvas.renderall.bind(canvas), { originx: 'left', originy: 'top', left: 100, top: 100 }); }; img.src = "site_image/temp/zig3.jpg"; // 2nd img var img1 = new image(); img1.onload = function(){ canvas.setbackgroundimage(img1.src, canvas.renderall.bind(canvas), { originx: 'left', originy: 'top', left: 300, top: 300 }); }; img1.src = "site_image/temp/zig1.jpg";but first bg replaced second one, multiple backgrounds controlled user possible or not?
one more issue faced, have json of fabricjs, include image(normal image not background), when show user want image become background of canvas,
just use absolute path in json file , use ajax change backgroud image. can follow [link][1]
[1]: https://jsfiddle . net/manish1706/qxnh4j53/
Comments
Post a Comment