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

Comments

  • 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:
    http://jsfiddle.net/m3ad1drf/
  • thank you, worked as expected
Sign In or Register to comment.