Enyojs somehow autoresizes my canvas tag

I dont use enyo.canvas, but add a canvas tag manually in my Component : { tag: "canvas", width: 200, height: 200 }.

Somehow the canvas always has size of 300x150 when it is rendered. Has enyojs anything to do with to autoresizing?

I use enyo 2.2


  • I think that is the default dimensions for a canvas

    Change your code to:

    { tag: "canvas", attributes: {width: 200, height: 200} }

    attributes hash puts the properties into the html tag.
  • You beat me to it, Chris.

    Basic Enyo controls don't have width and height properties that map to DOM attributes. Use the attributes property as Chris suggested for your canvas.

    A lot can be learned by looking at the Enyo source code. Even if you're not using enyo.canvas, looking at the source code for it can be very helpful if you want to "roll your own".

    meanwhile, here's a jsfiddle demo:
  • thank you, worked as expected
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!