Make enyo.canvas fit

I have this fiddle: http://jsfiddle.net/y9mhE/3/

Now I want the canvas control to match the parent div. Since it inherits enyo.control, I have to use the "fit" property, but this does not work.

is it a mistake or am i missing something

( http://enyojs.com/api/#enyo.Canvas )

The canvas control has a width and height property (default is 500), maybe this overrides the fit property?

I have to include the code here, therefore:

enyo.kind({ name: "App", kind: enyo.Control, fit: true, components: [ { kind:enyo.Canvas, name:"canvas", fit:true } ] });​ 
+4
source share
1 answer

The fit property is not of the enyo.Control type; it can only be used in a suitable form. Therefore, change the look of your applications to "FitableColumns" or "FittableRows" (or set layoutKind from "FittableColumnsLayout" or "FittableRowsLayout"), for example:

 enyo.kind({ name: 'App', kind: 'FittableColumns', /* or: kind: enyo.Control, layoutKind: 'FittableColumnsLayout', */ components: [ { name: 'canvas', kind: enyo.Canvas, fit: true // works now because of parents fittable layout } ] }); 

I updated your fiddle: http://jsfiddle.net/y9mhE/7/

+1
source

All Articles