这是我的代码
$("#textbackground").click(function() {
var obj = canvas.getActiveObject();
![enter image description here][1]
//alert("weight");
if (!obj) return;
obj.setTextBackgroundColor('rgb(0,200,0)');
canvas.renderAll();
});
我必须将背景颜色设置为仅文本,如下链接所示,但我将背景颜色设置为方形文本,而不是仅文本 enter link description here
那么我该如何设置
obj.setTextBackgroundColor('rgb(0,200,0)');
最佳答案
使用fabric.Object
set(key, value) 功能。
obj.set('backgroundColor', 'rgb(0,200,0)');
关于javascript - 如何使用 fabricjs 设置文本背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18673368/