svg – dojox.gfx文本和组节点的边界框

dojo中getBoundingBox()的文档说:

Returns a bounding Box of a shape. A
text shape is a point-based object,so
it doesn’t define a bounding Box.

我不明白。 Web的矢量图形的任何合理的实现包括文本对象的边界框(raphaelJS和jQuery SVG是)!这里,“基于点的对象”是什么意思?

我找不到Group对象的边界框的引用,但是当使用最新的Dojo版本时,getBoundingBox对组也返回null

我可以很容易地为矩形自己做边界框,但是我需要边界框的唯一真正有问题的形状是组和文本。

我结束hotpatching dojo喜欢:

dojox.gfx.Text.prototype.getBoundingBox = function() { return this.rawNode.getBBox();});
dojox.gfx.Group.prototype.getBoundingBox = function() { return this.rawNode.getBBox();});

这当然只适用于SVG输出前端。

但我不知道,我错过了什么?有更好的方法吗?

I found no reference for a bounding Box for Group object,but when using the latest Dojo version,getBoundingBox returns null for Groups as well

这个问题与this bug fix有关吗?听起来像对我。它被改变了7个月前由pruzand和标记为固定

http://bugs.dojotoolkit.org/ticket/7019

更新2012-07-24:我在本地下载release-1.8.0rc1并在解决的票证中设置same test。这确实已在1.8中修复,getBoundingBox返回null的组在票证中解决。测试脚本成功返回:

bBox of group: {"x":0,"y":2,"endX":238,"endY":379,"width":238,"height":377}
transformed bBox: [{"x":277.7302117816355,"y":152.5448441073243},{"x":512.114456998541,"y":193.87311039205372},{"x":446.64909401810826,"y":565.1456332776561},{"x":212.26484880120276,"y":523.8173669929267}]

此外,根据this twitter post,1.8是值得释放在一两个星期的价值。

相关文章

我有一个网格,可以根据更大的树结构编辑小块数据.为了更容易...
我即将开始开发一款教育性的视频游戏.我已经决定以一种我可以...
我正在使用带有Grails2.3.9的Dojo1.9.DojoNumberTextBox小部...
1.引言鉴于个人需求的转变,本系列将记录自学arcgisapiforja...
我正在阅读使用dojo’sdeclare进行类创建的语法.描述令人困惑...
我的团队由更多的java人员和JavaScript经验丰富组成.我知道这...