You found a bug! We've classified it as EXTJS-3572 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Oct 2010
    Posts
    20
    Vote Rating
    0
    Evantan is on a distinguished road

      0  

    Default [4.0.2a]Bugs in Ext.draw.Sprite.setAttributes()

    [4.0.2a]Bugs in Ext.draw.Sprite.setAttributes()


    Cannot do translate when set all args with 0(x==0 && y==0).
    Cannot do rotate when set all args with 0(x==0 && y==0 && degrees==0).
    Cannot do scale when set all args with 0(x==0 && y==0 && cx==0 && cy==0).

    Maybe this because in Ext.draw.Sprite's setAttributes() method:
    Code:
            translate = attrs.translate;
            translation = spriteAttrs.translation;
            if (translate) {
                if ((translate.x && translate.x !== translation.x) ||
                    (translate.y && translate.y !== translation.y)) {
                    Ext.apply(translation, translate);
                    me.dirtyTransform = true;
                }
                delete attrs.translate;
            }
    
            rotate = attrs.rotate;
            rotation = spriteAttrs.rotation;
            if (rotate) {
                if ((rotate.x && rotate.x !== rotation.x) || 
                    (rotate.y && rotate.y !== rotation.y) ||
                    (rotate.degrees && rotate.degrees !== rotation.degrees)) {
                    Ext.apply(rotation, rotate);
                    me.dirtyTransform = true;
                }
                delete attrs.rotate;
            }
    
            scale = attrs.scale;
            scaling = spriteAttrs.scaling;
            if (scale) {
                if ((scale.x && scale.x !== scaling.x) || 
                    (scale.y && scale.y !== scaling.y) ||
                    (scale.cx && scale.cx !== scaling.cx) ||
                    (scale.cy && scale.cy !== scaling.cy)) {
                    Ext.apply(scaling, scale);
                    me.dirtyTransform = true;
                }
                delete attrs.scale;
            }
    Should these code replace by: .. != undefined ?
    Sorry for poor english.

  2. #2
    Sencha - Support Team mike.estes's Avatar
    Join Date
    Mar 2011
    Location
    Redwood City, CA
    Posts
    221
    Vote Rating
    9
    mike.estes will become famous soon enough

      0  

    Default


    could you fill out the bug report template, specifically providing a test case here would help us process this faster.

  3. #3
    Sencha User
    Join Date
    Oct 2010
    Posts
    20
    Vote Rating
    0
    Evantan is on a distinguished road

      0  

    Default


    REQUIRED INFORMATION


    Ext version tested:
    • Ext 4.0.2a

    Browser versions tested against:
    • IE9
    • FF4

    Description:
    • Cannot do translate when set all args with 0(x==0 && y==0).
    • Cannot do rotate when set all args with 0(x==0 && y==0 && degrees==0).
    • Cannot do scale when set all args with 0(x==0 && y==0 && cx==0 && cy==0).

    Steps to reproduce the problem:
    • Create a sprite, do some translate/rotate /scale, and then do another translate/rotate /scale with all args set to zero.

    The result that was expected:
    • Both translate/rotate /scale can take effect.

    The result that occurs instead:
    • Only the first translate/rotate /scale take effect.

    Test Case:

    Code:
    	var drawComponent = Ext.create('Ext.draw.Component', {
    	    width: 400,
    	    height: 400,
    	    renderTo: document.body,
    	    viewBox: false
    	}), surface = drawComponent.surface;
    	var c = surface.add({
            type: 'rect',
    		fill: '#ccc',
    		x: 0,
    		y: 0,
    		width: 100,
    		height: 200,
    		translate: {
    			x: 100,
    			y: 100
    		},
    		rotate: {
    			x: 100,
    			y: 100,
    			degrees: 30
    		},
    		scale: {
    			cx: 10,
    			cy: 10,
    			x: 0.2,
    			y: 0.2
    		}
        });
        c.show(true);
        c.setAttributes({
    		translate: {
    			x: 0,
    			y: 0
    		},
    		rotate: {
    			x: 0,
    			y: 0,
    			degrees: 0
    		},
    		scale: {
    			cx: 0,
    			cy: 0,
    			x: 0,
    			y: 0
    		}
        }, true);


    HELPFUL INFORMATION


    Debugging already done:
    • Yes


    Maybe this because in Ext.draw.Sprite's setAttributes() method: (Colored code)
    Code:
            translate = attrs.translate;
            translation = spriteAttrs.translation;
            if (translate) {
                if ((translate.x && translate.x !== translation.x) ||
                    (translate.y && translate.y !== translation.y)) {
                    Ext.apply(translation, translate);
                    me.dirtyTransform = true;
                }
                delete attrs.translate;
            }
    
            rotate = attrs.rotate;
            rotation = spriteAttrs.rotation;
            if (rotate) {
                if ((rotate.x && rotate.x !== rotation.x) || 
                    (rotate.y && rotate.y !== rotation.y) ||
                    (rotate.degrees && rotate.degrees !== rotation.degrees)) {
                    Ext.apply(rotation, rotate);
                    me.dirtyTransform = true;
                }
                delete attrs.rotate;
            }
    
            scale = attrs.scale;
            scaling = spriteAttrs.scaling;
            if (scale) {
                if ((scale.x && scale.x !== scaling.x) || 
                    (scale.y && scale.y !== scaling.y) ||
                    (scale.cx && scale.cx !== scaling.cx) ||
                    (scale.cy && scale.cy !== scaling.cy)) {
                    Ext.apply(scaling, scale);
                    me.dirtyTransform = true;
                }
                delete attrs.scale;
            }


    [/CODE]


    Possible fix:
    • Replace colored code with ....!= undefined, or remove them all,I can't see any necessity

  4. #4
    Sencha User
    Join Date
    Oct 2010
    Posts
    20
    Vote Rating
    0
    Evantan is on a distinguished road

      0  

    Default


    BTW: my another post about bug in Ext.draw.Surface

  5. #5
    Sencha - Support Team mike.estes's Avatar
    Join Date
    Mar 2011
    Location
    Redwood City, CA
    Posts
    221
    Vote Rating
    9
    mike.estes will become famous soon enough

      0  

    Default


    thanks for updating your post, the test case helped me confirm the bug quickly. We have it filed as EXTJSIV-3572

Thread Participants: 1