1
我有一个Node.js项目,它使用jsdom和Raphael Js在我的服务器上生成SVG标记,一切都很顺利,直到我调用getBBox()时拉菲尔文本元素。getBBox()缺少文本元素的值
var paper = window.Raphael(10, 50, 320, 200);
var txt = paper.text(10, 10, 'hello world!');
console.log(txt.getBBox().toString()); // Returns: NaN NaN NaN × NaN
而...
var rect = paper.rect(10, 10, 10, 10);
console.log(rect.getBBox().toString()); // Returns: 10 10 10 × 10
会。这是什么原因,更重要的是有没有解决?
你可以试试你的代码JSFiddle吗?我给了这个漩涡,它按预期工作:[http://jsfiddle.net/hardwickj/JHqxw/](http://jsfiddle.net/hardwickj/JHqxw/) – James 2012-08-10 18:45:47