1. #1
    Sencha User
    Join Date
    Feb 2009
    Posts
    74
    Vote Rating
    -1
    bareflix is an unknown quantity at this point

      0  

    Default 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

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Posts
    74
    Vote Rating
    -1
    bareflix is an unknown quantity at this point

      0  

    Default 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:

    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);
    Then in my polling callback I do:

    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);
    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.

  3. #3
    Sencha User
    Join Date
    Feb 2009
    Posts
    74
    Vote Rating
    -1
    bareflix is an unknown quantity at this point

      -1  

    Default


    I was able to get it to work by calling the undocumented:

    Code:
    surface.setViewBox(0, 0, width, height);
    It seems like a bug to me that this is not done automatically when viewBox is true.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar