我正在使用 Scala.js 和 d3.js (scala-js-d3) 在Web应用程序中绘制SVG。我的问题是,对于我的背景图像,在iOS(iPhone)上使用Chrome时,
这是我添加图像的方式:
在Windows上,这将创建以下svg dom元素(并且一切都按预期工作):
我手头的iPhone很难进行调试,目前只能得到这些信息。我只知道在iOS上使用Chrome时,
load
事件没有被触发。在Windows上使用Chrome时会触发该事件。该图像在所有平台上都可见。这是我添加图像的方式:
d3.select("#backgroundImg")
.append("image")
.attr("id", "graphBackgroundImage")
.attr("width", "1954px")
.attr("height", "1532px")
.attr("xlink:href", "img/maps/map.png")
// TODO this load event does not trigger on iOS!
.on("load", (_: EventTarget) => { println("image loaded") } : Unit)
.on("error", (_: EventTarget) => { prinltn("an error has occured") } : Unit)
在Windows上,这将创建以下svg dom元素(并且一切都按预期工作):
<g id="backgroundImg">
<image id="graphBackgroundImage" width="1954px" height="1532px" xlink:href="img/maps/map.png"></image>
</g>
我手头的iPhone很难进行调试,目前只能得到这些信息。我只知道在iOS上使用Chrome时,
image loaded
没有被记录下来(也没有an error has occurred
日志)。