开发者

Sencha's body background get drawn on top of my canvas

I'm drawing on a canvas, and when I debug I can see that I get the things done, but then the sencha body background gets drawn on top of it.

My html is:

<body>
<canvas id="canvas"></canvas>
</body>

and I have some javascript that draws the things I need.

So I draw inside the canvas, but the html code that is generated has the following which is drawn on top of my canvas:

<body id="ext-gen10开发者_开发百科03" class=" x-desktop" style="width: 879px; height: 386px; ">

If I comment the sencha.css I don't have the problem anymore, but more things disappear with that, so obvoiusly that is not a solution What can I do to get the canvas on top of the background?

EDIT: A solution I found was to create the tag manually and adding it to the document:

canvas = document.createElement("canvas");
canvas.id = "canvas";
canvas.innerHTML = "myCanvas";
document.body.appendChild(canvas);

but I believe there must be a more elegant solution, besides, here I need to add something in the innerHTML or else I don't get the closing tag: .


I think the easiest way is to add an Ext.Panel and set the html property to the html code you want to add. For example:

var panel = new Ext.Panel({  html: '<canvas id="canvas"></canvas>' });

Then add panel to whatever your main container is.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜