gpt4 book ai didi

How many levels of recursion does SVG support?(SVG支持多少级别的递归?)

转载 作者:bug小助手 更新时间:2023-10-25 14:08:19 25 4
gpt4 key购买 nike



I cannot get past 2 levels. (Tried on Iceweasel and Chromium.)

我不能超过2级。(在冰鼠狼和铬上试过了。)



As a test, I tried a variant of the code presented in this earlier reply. This one consists of 3 separate files, where a.svg includes b.svg, and b.svg includes c.svg. (NB: This is not a cycle.)

作为测试,我尝试了前面回复中提供的代码的一个变体。这个文件由3个独立的文件组成,其中.svg包括b.svg,b.svg包括c.svg。(注:这不是一个周期。)



<!-- a.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#b58900" />
<image x="10" y="20" width="80" height="80" xlink:href="b.svg" />
</svg>




<!-- b.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#cb4b16" />
<image x="10" y="20" width="80" height="80" xlink:href="c.svg" />
</svg>




<!-- c.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#dc322f" />
</svg>


I expected to see a large dark yellow dot, a medium-sized orange dot, and a small red dot, but I see only the first two. In fact, what I see is exactly the same as what I would see if b.svg did not include c.svg.

我希望看到一个大的暗黄色点,一个中等大小的橙色点,和一个小红点,但我只看到前两个。实际上,我看到的和如果b.svg不包含c.svg时看到的完全一样。



Why is c.svg not being included?

为什么不包括C.svg?



Is there a way to get SVG recursion to work for more than 2 levels?

有没有办法让SVG递归在两个以上的级别上工作?


更多回答

I've uploaded the test files above to a.svg, b.svg, c.svg, with the addition of colored rectangles behind each image (to show where they should be). You can use the Developer Tools of Chrome to show that c.svg never attempts to load.

我已经将上面的测试文件上传到.svg、b.svg、c.svg,并在每个图像后面添加了彩色矩形(以显示它们应该在哪里)。您可以使用Chrome的开发人员工具来显示c.svg从不尝试加载。

If you post your use case you may get some very good recommendations on how to achieve what you're looking for. For example, you can have <svg>s inside other <svg>s and can manipulate this DOM with Javascript.

如果你发布你的用例,你可能会得到一些关于如何实现你想要的东西的非常好的建议。例如,您可以将S放在其他S内部,并可以使用Java脚本操作这个DOM。

优秀答案推荐

SVG when used as an image must be complete in a single file.

当SVG用作图像时,必须在单个文件中完成。




  • a.svg is not an image

  • b.svg is included as an image by a.svg and is therefore subject to the complete in a single file image rule so any images it contains must be included as data URIs.

  • c.svg is ignored as b.svg cannot refer to external files.



Convert c.svg to a data URI and include it inline in b.svg to get round this.

将c.svg转换为数据URI并将其内联包含在b.svg中以解决此问题。


更多回答

This is very good to know. Your profile leads me to think you may know a thing or two about this :)

很高兴知道这一点。你的个人资料让我觉得你可能对此略知一二:)

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