-
17 Aug 2011 1:21 AM #1
[4.0.5] BUG: Ext.draw.Sprite, setAttributes method, scale,
[4.0.5] BUG: Ext.draw.Sprite, setAttributes method, scale,
When calling the setAttributes() method of a sprite and setting the "scale" of it, there is a problem using the center of the scaling specification. Using the properties "cx,cy", as documented will not work. Instead the "centerX/centerY" properties of the underlaying rendering engine do work:
Code:track.setAttributes({ scale: {centerX: 0, centerY: 0, // working, but undocumented cx: 0, cy: 0, // documented, but not working x: 1.3, y: 1.5 } },true);
-
4 Nov 2011 7:45 AM #2
Thanks for the info.
Been looking all afternoon for this
Now I need to solve my issue when I click on the image to zoom and it throws the listener 3 times.
-
9 Jan 2013 3:53 PM #3
This bug still happens in ExtJS version 4.2.0.179.
In Ext.draw.Sprite, there is a setAttributes function that saves the scaling changes:
Note that only cx and cy are saved.Code:setAttributes: function(attrs, redraw) { /* other code */ newScaling = attrs.scaling || attrs.scale; scaling = spriteAttrs.scaling; delete attrs.scale; delete attrs.scaling; if (newScaling) { if (('x' in newScaling && newScaling.x !== scaling.x) || ('y' in newScaling && newScaling.y !== scaling.y) || ('cx' in newScaling && newScaling.cx !== scaling.cx) || ('cy' in newScaling && newScaling.cy !== scaling.cy)) { me.dirtyTransform = true; scaling.x = newScaling.x; scaling.y = newScaling.y; scaling.cx = newScaling.cx; scaling.cy = newScaling.cy; } } /* other code */ }
Then when the sprites are redrawn, the following code in Ext.draw.Surface is called which only uses centerX and centerY:
Code:scale: function(sprite) { var bbox, x = sprite.attr.scaling.x || 1, y = sprite.attr.scaling.y || 1, centerX = sprite.attr.scaling.centerX, centerY = sprite.attr.scaling.centerY; if (!Ext.isNumber(centerX) || !Ext.isNumber(centerY)) { bbox = this.getBBox(sprite, true); centerX = !Ext.isNumber(centerX) ? bbox.x + bbox.width / 2 : centerX; centerY = !Ext.isNumber(centerY) ? bbox.y + bbox.height / 2 : centerY; } sprite.transformations.push({ type: "scale", x: x, y: y, centerX: centerX, centerY: centerY }); },
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote