gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 05:34:26 26 4
gpt4 key购买 nike

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 也会为 Groups 返回 null

我自己可以轻松地为矩形制作边界框,但我需要边界框的唯一真正有问题的形状是组和文本。

我结束了热补丁 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 版预计将在一两周内发布。

关于svg - 文本和组节点的 dojox.gfx 边界框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1612831/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com