如何更改fabric.js上的默认selectionColor?

use*_*748 4 fabricjs

如何在fabric.js上更改默认的蓝色selectionColor?我试图在fabric.js中更改这些行,但没有效果:

selectionColor: 'rgba(17,119,255,0.3)',
selectionBorderColor:   'rgba(255, 255, 255, 0.3)',
editingBorderColor: 'rgba(102,153,255,0.25)',
Run Code Online (Sandbox Code Playgroud)

还有其他方法吗?

在此输入图像描述

The*_*ris 12

在此输入图像描述 好吧,现在我看到你需要的东西,你想要改变所选分组对象的边框,也可能是边框上的方块.

我在kitchennsink上测试它,它可以工作,你必须捕获选择事件,并在事件内部更改activeGroupborderColorcornerColor属性.

你的对象:选中的事件:

canvas.on('object:selected', function(o){
var activeObj = o.target;
if(activeObj.get('type') == 'group') {
     activeObj.set({'borderColor':'#fbb802','cornerColor':'#fbb802'});

 }
});
Run Code Online (Sandbox Code Playgroud)

希望有所帮助,祝你好运.