您可以从画布中获取活动对象并更改其属性,例如填充,中风。是否有可能获得一个自由绘制的画笔笔划并改变其颜色?
这是我正在运行的功能:
function dtUpdateColor(color) {
let c = color;
let o = canvas.getActiveObject();
// If a group selection, do nothing
if (canvas.getActiveGroup()) {
canvas.deactivateAll().renderAll();
} else {
// If single object selected
if ( c && o ) {
// Works for shapes, not brush
canvas.getActiveObject().fill = c;
// Doesn't work
canvas.getActiveObject().color = c;
canvas.renderAll();
}
}
}
答案 0 :(得分:2)
绘图创建路径,您可以通过更改stroke