Raphael JS and Text positioning?

前端 未结 4 1459
花落未央
花落未央 2020-12-23 14:02

I\'m trying to position text within the SVG canvas, by supplying x, y coordinates

var t = paper.text(50, 50, \"Raphaël\\nkicks\\nbutt!\");
<         


        
4条回答
  •  攒了一身酷
    2020-12-23 14:32

    Text-anchor property for text method is set to 'middle' by default.

    If you want to left align it then change text-anchor in attributes for the object:

    var t = paper.text(50, 50, "Raphaël\nkicks\nbutt!").attr({'text-anchor': 'start'});
    

提交回复
热议问题