在fabric-js 中,我正在制作一组矩形和文本字段,然后将其添加到画布中。我正在使用以下代码,但是一旦将其添加到画布中,我可以更改文本字段的文本吗?
我做了小提琴请检查,
var canvas = new fabric.Canvas('c');
var Bar = new fabric.Text('Bar', {selectable: false, top: 50, left: 10});
var rect = new fabric.Rect({width: 100, height: 100, left: 100, top: 100, fill: 'red'});
var group = new fabric.Group([rect, Bar], {selectable: true, top: 50, left: 100});
canvas.add(group);
canvas.renderAll();
$(document).click(function(e) {
console.log('click');
console.log('ActiveObject', canvas.getActiveObject());
console.log('ActiveGroup', canvas.getActiveGroup());
Bar.set('Text','Selectedoooooooo');
});