-
25 Jul 2011 9:17 AM #1
[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:
Should these code replace by: .. != undefined ?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; }
Sorry for poor english.
-
25 Jul 2011 10:29 AM #2
could you fill out the bug report template, specifically providing a test case here would help us process this faster.
-
25 Jul 2011 11:22 AM #3
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
-
25 Jul 2011 11:24 AM #4
-
25 Jul 2011 12:47 PM #5
thanks for updating your post, the test case helped me confirm the bug quickly. We have it filed as EXTJSIV-3572
You found a bug! We've classified it as
EXTJSIV-3572
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote