Closed janmaslik closed 1 year ago
Please create a jsfiddle showing your problem
I stumbled over this yesterday and now re-found this issue.
The mistake is, that e
is not the image but the event. So you need to access e.target
instead. And then you can use naturalWidth
: e.target.naturalWidth
.
Can you point me to the place where its written in the docs?
Bug report
1/ This example from your docs doesnt work at all:
image.on('load', function (e) { console.log(e.naturalWidth, e.naturalHeight) })
e.naturalWidth/e.naturalHeight are undefined2/ I tried to use something like this:
var img = svg.image("url-to-image"); img.on('load',function(){ console.log(this.image.node.width.baseVal.value); console.log(this.image.width()); })
BUT sometimes i get zeros in both console outputs (same page reload without code change). I think mine load-handler is in same order-level as your internal handler which fills those values.tested on Chrome , webpack + typescript