Yew: Canvas support?

Created on 3 Jan 2018  路  8Comments  路  Source: yewstack/yew

I was thinking of rewriting this: http://debug.elm-lang.org/edit/Mario.elm and realized there's no way to update a canvas, afaik. This is probably a far-off feature request, but I think it would be a fun one to add, and something that elm supports, so not outside the scope of the project, I would think?

Most helpful comment

Now that stdweb has canvas support, is there any progress on adding support to Yew?

All 8 comments

@empath I think you'd likely want to add a service of some sort to get the bridge for canvas support.

If someone is wanting to implement this, I would suggest adding it as a feature to stdweb and then making a service wrapper here. This library already depends on stdweb so it might make sense to add it there.

Looks like someone already went ahead and added it to stdweb. https://github.com/koute/stdweb/pull/80. It shouldn't be too hard to add here now.

@keeslinp I want to use the canvas fill_rect function from stdweb on a canvas element in a yew app, how can I do that? :)
I'm interested in contributing to expand the canvas API coverage in stdweb/yew.

Now that stdweb has canvas support, is there any progress on adding support to Yew?

Why a canvas tag in yew does not compile ?
From my naive understanding, yew should support all html tags out of the box without doing any special work ?

Secondly, for using the canvas api, does yew let me use stdweb out of the box ? which would allow to use the canvas api.
If so, the issue should be trivial to fix.

I don't have time to elaborate or look at this issue in details right now, but I used a canvas with yew recently: https://github.com/totorigolo/pathbot/blob/87df913bbee5906cb2ccc9e0387f9f14630a5386/src/lib.rs#L599

Hope this helps :)

I think this is no longer an issue, if not, please re-open!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alun picture alun  路  4Comments

IngwiePhoenix picture IngwiePhoenix  路  4Comments

djahandarie picture djahandarie  路  3Comments

ghost picture ghost  路  5Comments

Boscop picture Boscop  路  4Comments