Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-4415 in a recent build.
  1. #1
    Ext GWT Premium Member
    Join Date
    Apr 2009
    Location
    NYC
    Posts
    112
    Vote Rating
    1
    stan229 is on a distinguished road

      0  

    Default 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
    Browser versions tested against:[LIST][*]Chrome 26/LIST]Description:
    • 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.
    Steps to reproduce the problem:
    • 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
    The result that was expected:
    • Render all sprites with their properties
    The result that occurs instead:
    • Render all sprites with their individual properties
    Test Case:
    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;
        }
    });
    HELPFUL INFORMATIONScreenshot or Video:Possible fix:
    • In src/draw/Surface.js modify line 324 (add function implementation) to be:
      Code:
      sprite = me.prepareItems(args[0])[i];
      instead of
      Code:
      sprite = me.prepareItems(args[0])[0];

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

Thread Participants: 1

Tags for this Thread