gpt4 book ai didi

fabricjs - 如何增加 Fabric 对象的选择区域?

转载 作者:行者123 更新时间:2023-12-04 05:40:07 24 4
gpt4 key购买 nike

考虑以下代码:

var lineObj = new fabric.Line([120,200,320,200],{
stroke: '#000000',
strokeWidth: 1
});
canvas.add(lineObj);

由于宽度非常小,这 1 像素线很难选择。
我在这里想做的是增加它的选择区域。
像这样:

Line Corners

有什么办法可以做到这一点吗?

最佳答案

是的,我们有 padding值(value)。

var lineObj = new fabric.Line([120,200,320,200], {
stroke: '#000000',
strokeWidth: 1,
padding: 20
});
canvas.add(lineObj);

enter image description here

我有没有提到 Fabric 灵活而强大? :)

@markE 不错的解决方案!很高兴您发现浏览源代码很容易。

关于fabricjs - 如何增加 Fabric 对象的选择区域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15384394/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com