You found a bug! We've classified it as EXTJS-8187 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Touch Premium Member
    Join Date
    Sep 2010
    Location
    UK
    Posts
    54
    Vote Rating
    1
    Joe Kuan is on a distinguished road

      0  

    Default Possible bug? Scaling in CompositeSprite.setAttributes causes corrupted SVG image

    Possible bug? Scaling in CompositeSprite.setAttributes causes corrupted SVG image


    In ExtJs 4.1 the current CompositeSprite.setAttributes method is implemented as the following:
    PHP Code:
    setAttributes: function(attrsredraw) {
         var 
    0,
               
    items this.items,
                
    len this.length;
         for (; 
    leni++) {
                
    items[i].setAttributes(attrsredraw);
         }
         return 
    this;
    }, 
    I don't think it is totally correct because when I did the following:
    PHP Code:
    compositeSprite.setAttributes({
           
    scale: {
                 
    x0.5y0.5
            
    }
    }); 
    I ended up with a corrupted SVG image. Each individual SVG element is correctly scaled but NOT between their distance. This is because it hasn't taken account the bbox dimension of the WHOLE CompositeSprite when it comes to scaling. When items[i].setAttributes(attrs, redraw) is called, it will call Ext.draw.Surface.scale method which has the following the implementation:

    PHP Code:
    scale: function(sprite) {        
        var 
    bbox,
              
    sprite.attr.scaling.|| 1,
              
    sprite.attr.scaling.|| 1,
              
    centerX sprite.attr.scaling.centerX,
              
    centerY sprite.attr.scaling.centerY;

        if (!
    Ext.isNumber(centerX) || !Ext.isNumber(centerY)) {
             
    bbox this.getBBox(spritetrue);
             
    centerX = !Ext.isNumber(centerX) ? bbox.bbox.width centerX;
             
    centerY = !Ext.isNumber(centerY) ? bbox.bbox.height centerY;
        }
        
    sprite.transformations.push({
             
    type"scale",
             
    xx,
             
    yy,
             
    centerXcenterX,
             
    centerYcenterY        
        
    });
    }, 
    As you can see, the line
    PHP Code:
    bbox this.getBBox(spritetrue); 
    doesn't take the account the fact that the element is part of the CompositeSprite

    IMHO, I think the CompositeSprite.setAttributes should be something like that and cascade the change down to the Surface implementation:
    PHP Code:
    setAttributes: function(attrsredraw) {
         var 
    bbox this.getBBox();
         var 
    0,
               
    items this.items,
                
    len this.length;
         for (; 
    leni++) {
                
    items[i].setAttributesByGroup(attrsbboxredraw);
         }
         return 
    this;
    }, 
    Many thanks
    Joe

  2. #2
    Touch Premium Member
    Join Date
    Sep 2010
    Location
    UK
    Posts
    54
    Vote Rating
    1
    Joe Kuan is on a distinguished road

      0  

    Default Fixed. Solution here

    Fixed. Solution here


    Actually, this fix is a lot easier than I thought.

    First for the CompositeSprite object, the usage of setAttributes method MUST contain cx and cy for the whole BBox in scaling, i.e. (This should be in the method documentation)

    PHP Code:
    var bbox spriteGroup.getBBox();
    sprite.setAttributes({
         
    scale: {
               
    x0.5,
               
    y0.5,
               
    cxbbox.bbox.width 2,
               
    cybbox.bbox.height 2
         
    }, true);
    }); 
    The above code will make sure each sprite is scaled within the perspective of the composite sprite.

    Next, you need to fix the centerX and centerY typos bug in the Ext.draw.Surface.scale method

    PHP Code:
    scale: function(sprite) {
        var 
    bbox,
        
    sprite.attr.scaling.|| 1,
        
    sprite.attr.scaling.|| 1,
        
    // Typo 
        // centerX = sprite.attr.scaling.centerX,
        // centerY = sprite.attr.scaling.centerY;
        
    centerX sprite.attr.scaling.cx,
        
    centerY sprite.attr.scaling.cy

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi