SVG getBBox函数在FireFox&中返回零.边缘(但不在Chrome中) [英] SVG getBBox function returns zero in FireFox & Edge (but not in Chrome)
问题描述
我有一个svg元素(使用D3创建).
I have an svg element (created with D3).
在chrome中,"getBBox"功能非常出色,但在fireFox和Edge中失败.以为我在几个地方都看到了这个讨论(例如,此处,此处)都不是给出了明确的答案.
while in chrome the "getBBox" function works fabulously, it fails in fireFox and Edge. Thought I saw this discussion in couple of places(e.g. here, here) none of them yielded a clear answer.
这也不起作用-getBoundingClientRect() 而且我的元素不在下面(我看到它可能会引起问题).
This doesn't work either - getBoundingClientRect() And my element is not underneath (i saw that it might cause issues).
非常感谢!
推荐答案
好,我发现了问题所在.
Ok, i found what was wrong.
Chrome可以通过"display:none"处理"g"个元素.但是Firefox和edge将其视为不存在/零尺寸".
Chrome can handle "g" elements with "display : none". but Firefox and edge treat it as "non-existing/zero dimensions".
很抱歉.
这篇关于SVG getBBox函数在FireFox&中返回零.边缘(但不在Chrome中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!