通过'loadFromJSON'将有效的JSON对象加载到画布后,我遇到了画布问题。画布渲染带有对象的有效画布,甚至是正确的背景图像。出于某种原因,我无法选择任何东西。如果我尝试单击并选择几个对象,则甚至不显示蓝色选择框。我确定该对象是有效的,因为我已将一个有效的教程对象粘贴到loadFromJSON和我的JSON对象到jsfiddle教程中。
如果我点击鼠标右键......我会看到一个保存图片选项,如果你问我,这看起来有点奇怪。
这是我的代码:
canvas.loadFromJSON(data, canvas.renderAll.bind(canvas), function(object, o) {
o = $.fn.mapCanvasFieldset(object); // custom function
});
canvas.renderAll();
JSON对象(数据变量):
{
"objects":[
{
"type":"image",
"originX":"left",
"originY":"top",
"left":133,
"top":108,
"width":267,
"height":80,
"fill":"rgb(0,0,0)",
"stroke":null,
"strokeWidth":0,
"strokeDashArray":null,
"strokeLineCap":"butt",
"strokeLineJoin":"miter",
"strokeMiterLimit":10,
"scaleX":0.33,
"scaleY":0.33,
"angle":0,
"flipX":false,
"flipY":false,
"opacity":1,
"shadow":null,
"visible":true,
"clipTo":null,
"backgroundColor":"",
"fillRule":"nonzero",
"globalCompositeOperation":"source-over",
"transformMatrix":null,
"skewX":0,
"skewY":0,
"src":"",
"filters":[],
"resizeFilters":[],
"crossOrigin":"",
"alignX":"none",
"alignY":"none",
"meetOrSlice":"meet"
}
],
"background":"",
"backgroundImage":{
"type":"image",
"originX":"left",
"originY":"top",
"left":0,
"top":0,
"width":350,
"height":350,
"fill":"rgb(0,0,0)",
"stroke":null,
"strokeWidth":0,
"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",
"transformMatrix":null,
"skewX":0,
"skewY":0,
"src":"",
"filters":[],
"resizeFilters":[],
"crossOrigin":"",
"alignX":"none",
"alignY":"none",
"meetOrSlice":"meet"
}
}
修改 也许关键信息;我正在Fancybox中加载我的画布
答案 0 :(得分:1)