具有异常/错误行为的JointJS breakText

时间:2018-12-14 14:33:01

标签: jointjs

我在rect内部使用breakText,但是当我以空字符开始文本时,该文本未包装。这是预期的行为吗?

另一点:在第二个矩形的包装文本中,我希望看到省略号字符串('...')

var wraptext1 = joint.util.breakText(' test text with wrap incl. line break width: 50 of rect height: 50 - ellipsis: ... does not work ', { width:     50, height: 50 }, { 'font-size': 10 }, { ellipsis: '...' });

var myCell1 = new joint.shapes.basic.Rect({
  size: { width: 50, height: 50 },
  attrs: {
    text: {
      text: wraptext1,
      'font-size': 10

    }
  }
});
myCell1.position (200,200);
main.graph.addCell (myCell1);


var wraptext2 = joint.util.breakText('test text with wrap incl. line break width: 50 of rect height: 50 - ellipsis: ... does not work ', { width: 50, height: 50 }, { 'font-size': 10 }, { ellipsis: '...' });
var myCell2 = new joint.shapes.basic.Rect({
  size: { width: 50, height: 50 },
  attrs: {
    text: {
      text: wraptext2,
      'font-size': 10
          }
  }
});
myCell2.position (300,300);
main.graph.addCell (myCell2);

rect without and with wrapped text

0 个答案:

没有答案