Closed bergwerf closed 1 year ago
There was #48, but did anyone produce a test afterwards? If there is an example of DrawImage somehow working, I would be happy to use it to make mine work (as far as I understand what I am doing is legitimate).
It turns out that ValueOf
in js.go
doesn't manage to extract the underlying js.Value
. Confusingly the stack trace points to different method names and line numbers than are actually in the syscall/js/js.go
in my GOROOT
(this contains a makeArgs
while the stack trace is talking about a convertArgs
, something gets mixed up but I couldn't find out what).
Anyway, we can help js.go
a bit:
ctx.Call("drawImage", image.Underlying(), dx, dy)
Thanks for reporting.
There was #48, but did anyone produce a test afterwards?
That was the v1 API, which used the GopherJS js
package. I suspect this issue affects the v2 API only, which uses syscall/js
and is more strict.
Also see #71. I think we need to apply the same fix in more places, including DrawImage
.
This is my code:
On Firefox it gives me:
Error: invalid arg: *dom.HTMLImageElement
with the stack trace pointing toconvertArgs js.go:174
.