
在本教程中,我们将使用 FabricJS 设置 Circle 的比例因子(边框)。圆形是 FabricJS 提供的各种形状之一。为了创建一个圆圈,我们必须创建一个 Fabric.Circle 类的实例并将其添加到画布中。我们可以使用 borderScaleFactor 属性来指定控制边框的对象的比例因子。
语法
new fabric.Circle({ borderScaleFactor: Number }: Object)参数
选项(可选) - 此参数是一个对象这为我们的圈子提供了额外的定制。使用此参数,可以更改与 borderScaleFactor 为属性的对象相关的颜色、光标、描边宽度和许多其他属性等属性。
ul>borderScaleFactor − 此属性接受指定边框粗细的数字。默认值为 1。
选项键
示例 1
borderScaleFactor属性的默认行为
让我们看一个描述 borderScaleFactor 属性默认行为的示例。尽管我们在本例中指定了它,但默认情况下,即使未指定,borderScaleFactor 也会使用 1。
Setting the scale factor (border) of circle using FabricJS
Select the object and notice its border. Here we have set borderScaleFactor at 1, which is the default value.
示例 2
将 borderScaleFactor 作为键传递
让我们看一下在主动选择圆形对象时增加其边框厚度的代码。在此示例中,我们为 borderScaleFactor 指定了值 5,该值指定边框的厚度。
Setting the scale factor (border) of a circle using FabricJS
Select the object and notice the thickness of its border. Here we have set the borderScaleFactor at 5.










