Jquery 如何根据jointjs-Rappid中的文本调整矩形大小

Jquery 如何根据jointjs-Rappid中的文本调整矩形大小,jquery,jointjs,rappid,Jquery,Jointjs,Rappid,我使用jointjs/rappid,其中我使用默认矩形在图形上绘制元素 我可以通过扩展standard.rectangle并更改属性来更改元素内的文本: joint.shapes.standard.Rectangle = joint.shapes.standard.Rectangle.extend({ setText: function (text) { this.attr('text/text', text); } }); 这可以工作,但元素不会自

我使用jointjs/rappid,其中我使用默认矩形在图形上绘制元素

我可以通过扩展standard.rectangle并更改属性来更改元素内的文本:

joint.shapes.standard.Rectangle = joint.shapes.standard.Rectangle.extend({
    setText: function (text) {
        this.attr('text/text', text);      
    } });
这可以工作,但元素不会自动调整为文本的长度

如何调整元素(矩形)的大小以使文本适合它