My canvas id is "canvas-panel" I want to redraw my canvas using the localStorage object value when go to the next page. I am getting canvas object using localStorage object like below:
var myCanvas = JSON.parse(localStorage.getItem('canvas'));
JSON formate:
{
"objects":[
{
"type":"image",
"originX":"left",
"originY":"top",
"left":42,
"top":311,
"width":100,
"height":100,
"fill":"rgb(0,0,0)",
"stroke":null,
"strokeWidth":1,
"strokeDashArray":null,
"strokeLineCap":"butt",
"strokeLineJoin":"miter",
"strokeMiterLimit":10,
"scaleX":1,
"scaleY":1,
"angle":0,
"flipX":false,
"flipY":false,
"opacity":1,
"shadow":null,
"visible":true,
"clipTo":null,
"backgroundColor":"",
"fillRule":"nonzero",
"globalCompositeOperation":"source-over",
"src":"http://stg.souqueen.com/media/catalog/product/cache/1/image/300x300/9df78eab33525d08d6e5fb8d27136e95/1/9/19b_1024i1.PNG",
"filters":[
],
"crossOrigin":"",
"alignX":"none",
"alignY":"none",
"meetOrSlice":"meet"
}
],
"background":""
}
I am getting all canvas object with the help of this thread Select All the objects on canvas using Fabric.js