PDA

View Full Version : Some Problems around Ext.draw.Component



börn
1 Dec 2011, 5:00 AM
Hello there,

I'm currently running into some problems with ext drawing. I use the following code for adding Sprites to a draw component and I'm a bit confused.

First I noticed that the only solid thing is to render the draw component to body or a <div> - when adding the component to a panel, i did not see anything (is this wanted behaviour?).

Second I want to add Sprites to an existing draw component by using the surface container in it like in the code below. That works, but I see a reserved space above the sprite I added later to the surface!

I'm also having problems in overriding the draw component and adding items in the constructor or initComponent function. Any clues about that?

TIA
börn


paper = Ext.create('Ext.draw.Component', {
width: 300,
height: 300,
autoShow: true,
viewBox: false,
//items: {dont wanted yet}
renderTo: 'content'
});


paper.createSurface(); //<-- failure!


Ext.define('Test.Control.Event', {
extend: 'Ext.draw.Sprite',


constructor: function()
{
this.callParent([
{
type: 'circle',
fill: '#FCCEED',
radius: 30,
x: 50,
y: 50,
surface: paper.surface
}
]);
}
});


var s = paper.surface.add(new Test.Control.Event());
s.show(true);

börn
1 Dec 2011, 5:08 AM
Damn... Okay - the second problem was around "paper.createSurface()". By this a second surface is created for the component - my problem was, when not inserting items directly, the surface wasn't defined... but now that works somehow.

But the other problems I raised are still annoying ;)