Raphael JS和Text定位? [英] Raphael JS and Text positioning?
本文介绍了Raphael JS和Text定位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在SVG画布中定位文字,方法是提供 x,y坐标
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!");
但不会像所有其他对象一样定位文字......
but does not position the text like all other objects...
x,y坐标指定对象的中心! 不是左上角像素!
x, y coordinates specify the center of the object! Not the "left and top most" pixel!
我希望 左对齐 文本沿着一行,与标准HTML相同。
I would like to "left align" the text along a line, same as standard HTML.
帮助将非常感谢。
推荐答案
已解决!
使用关注
Resolved!
By using the following
paper.print(100, 100, "Test string", paper.getFont("Times", 800), 30);
它现在对齐左边的文字。
it now aligns text on the left.
这篇关于Raphael JS和Text定位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文