我正在向画布添加svg并想要设置自定义元素参数。我在控制日志getActiveObject()时显示自定义参数,但是当我们使用canvas.toJSON()时,元素参数节点值不会改变。
error :: forall (r :: RuntimeRep). forall (a :: TYPE r). HasCallStack => [Char] -> a
现在,当我调用JSON.stringify(json)时,Element Parameter节点不会使用shape.set()方法中设置的值进行覆盖。
答案 0 :(得分:0)
将fabric.Object.prototype.toObject =(function(toObject){...}替换为
fabric.Object.prototype.toObject = (function (toObject) {
return function () {
return fabric.util.object.extend(toObject.call(this), {
ElementParameters:this.ElementParameters
});
};
})(fabric.Object.prototype.toObject);