-
1 Nov 2011 12:27 PM #1
Unanswered: Draw component auto scaling
Unanswered: Draw component auto scaling
I have a draw component that I update ever time I poll my server. It seems to scale to the first image I draw, but if the updated image is bigger or smaller, it still scales to the size of the first image.
I am graphing network connections, so the drawing size can change with every update.
Is there an event or a function I need to call after updating the Ext.draw.Component or the surface to get it to update it's scale?
--
Chris
-
1 Nov 2011 12:35 PM #2
code to clarify what I'm doing
code to clarify what I'm doing
I create the draw component with an initial place-holder box:
Then in my polling callback I do:Code:draw = Ext.create('Ext.draw.Component', { id: "MainDraw", viewBox: true, items: [ { type: 'rect', zIndex : -2, stroke : "#FF0000", fill : "#0000FF", x: 0, y: 0, width: 2000, height: 1000 }] }); window.add (draw);
but the new rect is not scaled to fill the available area like the original one was. It is scaled as if the orginal rec were still part of the drawing.Code:var surface = Ext.getCmp('MainDraw').surface; surface.removeAll (true); var sprite = Ext.create('Ext.draw.Sprite', { surface: surface, type: 'rect', zIndex : -2, stroke : "#FF0000", fill : "#0000FF", x: 200, y: 200, width: 50, height: 50 } ); sprite.show (true);
-
2 Nov 2011 10:20 AM #3
I was able to get it to work by calling the undocumented:
It seems like a bug to me that this is not done automatically when viewBox is true.Code:surface.setViewBox(0, 0, width, height);


Reply With Quote