New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onLoad not called when loading paper.Raster from canvas #924
Comments
I don't think an onLoad even makes sense for a passed canvas object, as that's a buffer in memory, not something you load form an external source. But it would make sense for it to be called if you pass an image object which hasn't been loaded yet. So that would be a bug. |
I have to disagree and here's a simple example why such behavior is quite weird. Just imagine you're writing a library which accepts a picture in the configuration options, loads it to If you don't call So please, keep the api consistent and invoke the |
Well, there are different ways of defining consistency. Currently, only the setter for The setter for The constructor looks at the passed object and decides if it should use the From where I stand, I think the current behavior is pretty consistent, and adding what you'd like to add would make it unclear as to what is actually happening internally. |
Thinking a bit more about this, I think I could move the whole |
This turned into a rather big undertaking that made me add functionality to jsdom (jsdom/jsdom#1365) and prioritize #739. Things are now in place for this to be addressed next. |
According to the docs
source: HTMLImageElement⟋HTMLCanvasElement⟋String — the source of the raster
sopaper.Raster(source, ...)
constructor should work correctly when given a canvas.Let's try this:
If we replace someCanvas with url or data url, the
onLoad
callback is called. When given a canvas, it loads successfully but callback isn't invoked. Tested on paper 0.9.25.// Edit: after looking into the source, it appears that onLoad won't be called when passed an image too.
The text was updated successfully, but these errors were encountered: