-
25 Apr 2013 10:31 AM #1
Ext.draw.Surface add function does not render an array of sprites correctly
Ext.draw.Surface add function does not render an array of sprites correctly
REQUIRED INFORMATIONSencha Touch version tested:
- Sencha Touch 2.2
- When using an Ext.draw.Surface instance to add sprites to it at runtime, you can pass in array of sprites and it will render them, but it will only use the config properties of the first sprite.
- Render an instance of Ext.draw.Component
- Initialize an array of objects containing Ext.draw.sprite.Sprite config properties
- Get Draw Component's Surface instance and call add function with the array as an argument
- Render all sprites with their properties
- Render all sprites with their individual properties
HELPFUL INFORMATIONScreenshot or Video:Possible fix:Code:Ext.define('TNR.view.CanvasGrid', { extend : 'Ext.draw.Component', xtype : 'canvasgrid', initialize : function () { var me = this, sprites = me.getGridSprites(); me.getSurface().add(sprites); me.callParent(); }, getGridSprites : function () { var length = 16, sprites = [], type = 'rect', width = 25, height = 25, fillStyle = '#fff', i, j; for (i = 0; i < length; ++i) { for (j = 0; j < length; ++j) { sprites.push({ type : type, width : width, height : height, fillStyle : fillStyle, x : 5 + (width*j*2+10), y : 5 + (height*i*2+10) }); } } return sprites; } });- In src/draw/Surface.js modify line 324 (add function implementation) to be:instead ofCode:
sprite = me.prepareItems(args[0])[i];
Code:sprite = me.prepareItems(args[0])[0];
-
25 Apr 2013 10:33 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
Thanks for the report! I have opened a bug in our bug tracker.
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-4415
in
Sprint 33.


Reply With Quote