-
25 Mar 2011 1:25 AM #1
[FIXED-EXTJSIV-328] Dynamically adding Sprites to a Surface
[FIXED-EXTJSIV-328] Dynamically adding Sprites to a Surface
For an application I need to dynamically add sprites to a surface.
I define my class like this:
But when I try to add this to the surface it gives an error on line 20937.Code:Ext.define('Test.Control.Event', { extend: 'Ext.draw.Sprite', type: 'circle', x: 150, y: 150, radius: 100, fill: '#cc5', stroke: 'red' }); Ext.preg('Test.Control.Event', Test.Control.Event);
Code:custom = me.surface.customAttributesThis is the code where I add my sprite to the surface:'surface.customAttributes' is empty or no object
I there any way to fix this so that I can define sprites and add them to the surface? I'd like to work with them object oriented.Code:canvas = new Ext.draw.Component({ viewBox: false }); //create a window to place the draw component in Ext.create('Ext.Window', { width: 1000, height: 500, layout: 'fit', items: [canvas] }).show(); var lEvent = new Test.Control.Event(); canvas.surface.add(lEvent);
Or is this already possible and am I doing it wrong?Last edited by Jamie Avins; 25 Mar 2011 at 6:47 AM. Reason: Added some code for clarification
-
26 Mar 2011 7:16 PM #2
Hi,
Thanks for the report. This has been fixed now. The way of creating and drawing the sprite is now:
Note that the constructor of the subclass has to be extended to pass in the configuration options to the superclass constructor.HTML Code:var canvas = Ext.create('Ext.draw.Component', { viewBox: false }); Ext.define('Test.Control.Event', { extend: 'Ext.draw.Sprite', constructor: function() { this.callParent([{ type: 'circle', x: 150, y: 150, radius: 100, fill: '#cc5', stroke: 'red', surface: canvas.surface }]); } }); //create a window to place the draw component in Ext.create('Ext.Window', { width: 1000, height: 500, layout: 'fit', items: [canvas] }).show(); var s = canvas.surface.add(new Test.Control.Event()); s.show(true);
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
[FIXED-EXTJSIV-330] lastComponentSize undefined problem when adding grids to tabpanel
By RodneyEdie in forum Ext:BugsReplies: 1Last Post: 25 Mar 2011, 7:02 AM -
[FIXED-EXTJSIV-191] Component.js typos
By LesJ in forum Ext:BugsReplies: 1Last Post: 21 Mar 2011, 3:12 PM -
[FIXED-442]Dynamically adding tabs to a tabpanel
By logicmedia in forum Sencha Touch 1.x: BugsReplies: 7Last Post: 22 Nov 2010, 8:15 AM -
[FIXED-220] Dynamically adding radio with numeric value to fieldset throwing error
By meyerovb in forum Sencha Touch 1.x: BugsReplies: 3Last Post: 8 Sep 2010, 8:14 PM -
adding image in tool-sprites
By bhaskar1605 in forum Ext 2.x: Help & DiscussionReplies: 5Last Post: 14 Oct 2008, 3:56 AM


Reply With Quote