Canvas - Some vague questions

I'm building a calendar app and I want to use canvas to draw into each day box. I creating a separate canvas for each calendar day. I'm able to draw the date into it by looping through them but if I try to update the date to represent a different month the old date remains and new date gets drawn on top.

my kinds:
{name: "dayBox", kind: "FittableRows",  fit: true, style: " width: 100%; height: 100%;", components: [
	{name: "canvas", kind: "enyo.Canvas", fit: true, style: "width: 100%; ", components: [
		{name: "dateNum", kind: "enyo.canvas.Text", bounds:{t:150, l:5, h:40, w:40}, color:"black", text:"", font:"75pt times "},
		{name: "today", kind: "enyo.canvas.Circle", bounds:{t:100, l:100, w:120}, color:"", outlineColor:""},
In my loop I change the date with:

It worked in my previous version that did not use canvas.

Is having multiple canvas kinds an issue? Would be better to draw the entire calendar in one canvas?


  • this.$.canvas.update();
    Yes. I have it at the end, after I draw new date.

    I read that you can clear the canvas with canvas.width = canvas.width;.
    Not sure sure how to implement it in enyo...getting errors with set and get
  • you should be able to do so like:

    this.$.canvas.hasNode().width = this.$.canvas.hasNode().width
  • It worked when I removed the 'fit:true' from canvas kind...also solved another problem: when I used fit: true the canvas stuff shrunk very tiny... now its normal size again.

    Thanks all!
Sign In or Register to comment.