SVG图像保存和加载Json预览后,显示的大小也将变大或变小。
请检查我是否已创建jsfiddle链接: http://jsfiddle.net/bw1kj4oh/8/
fabric.loadSVGFromString(document.getElementById('test').outerHTML, function (objects, options) {
obj = fabric.util.groupSVGElements(objects, options);
canvas.add(obj);
});
document.getElementById('json').addEventListener('click', function () {
var json = canvas.toJSON();
canvas.clear();
canvas.loadFromJSON(json, function () {
canvas.setActiveObject(canvas.getObjects()[0]);
canvas.renderAll();
});
});
答案 0 :(得分:1)