I am using Scala.js and d3.js (scala-js-d3) to draw an SVG in a web application. The problem I have is that for my background image the load
event is not triggered when using Chrome on iOS (iPhone). It does trigger when using Chrome on Windows. The image itself is visible on all platforms.
Here is how I add the image:
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)
On Windows this creates the following svg dom element (and everything works as expected):
<g id="backgroundImg">
<image id="graphBackgroundImage" width="1954px" height="1532px" xlink:href="img/maps/map.png"></image>
</g>
It is a bit hard to debug on the iPhone I have, so this is all I found out so far. I just know that image loaded
is not logged when using Chrome on iOS (there is also no an error has occured
log).
from Image onLoad event is not triggered using Chrome on iOS
No comments:
Post a Comment