FabricJs 中 Canvas 初始化的可用选项是什么?
What are the available options for Canvas initialisation in FabricJs?
initialize
根据文档 here
采用“选项”对象
但是,似乎没有定义选项对象。我简单地搜索了源代码,但没有透露任何信息。
在哪里可以获得选项对象的定义?
您可以将 options
对象作为构造函数的第二个参数传递,如下所示:
new fabric.Canvas('c', {
width: 600,
height: 600
})
然后调用initialize
方法时options
对象中的所有props,最后会设置为fabriccanvas对象。你可以在源代码中看到它here。
所以,options对象的定义就是fabric.Canvas的所有props和methods。您可以在 initialize
方法下方的源代码中看到它们,uniScaleTransform
、uniScaleKey
、centeredScaling
等。您可以将它们全部传递给 options
对象
initialize
根据文档 here
但是,似乎没有定义选项对象。我简单地搜索了源代码,但没有透露任何信息。
在哪里可以获得选项对象的定义?
您可以将 options
对象作为构造函数的第二个参数传递,如下所示:
new fabric.Canvas('c', {
width: 600,
height: 600
})
然后调用initialize
方法时options
对象中的所有props,最后会设置为fabriccanvas对象。你可以在源代码中看到它here。
所以,options对象的定义就是fabric.Canvas的所有props和methods。您可以在 initialize
方法下方的源代码中看到它们,uniScaleTransform
、uniScaleKey
、centeredScaling
等。您可以将它们全部传递给 options
对象