1. #1
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,311
    Vote Rating
    109
    LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light

      0  

    Default [IE7] - can't remove sprites

    [IE7] - can't remove sprites


    I have a weird problem with a drawing application that I'm trying to upgrade to 4.1 Beta...

    This is a floor planning app. The way it works is quite simple. I select a building and floor plan is drawn. I select another building and the previous floor plan is removed and a new plan is drawn.

    This works fine in 4.0.6 (IE7 and newer browsers). However, after switching to 4.1 Beta, after I select the 4th building, the previous floor plan is not removed and a new plan is drawn on top of the old one.

    This happens only in IE7, Firefox is fine. When I switch back to 4.0.6, IE7 works fine as well.

    I don't see any error messages. Any idea what could be happening?

    It's not easy to come up with a test case

  2. #2
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,311
    Vote Rating
    109
    LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light

      0  

    Default


    I managed to create a small test case recreating the problem.

    Click the 'Add Green Sprite' button and then click the 'Add Blue Sprite' button.

    Alternate button clicks... eventually (under 20 clicks) you will see both sprites, .i.e. the removeAll() call fails to remove the sprites.

    NOW here is the interesting point... If I remove the sprite ids "blue" and "green", then the sprites are removed correctly. Use IE7 for testing.

    Code:
    var draw = Ext.create('Ext.draw.Component', {
        viewBox: false,
        width: 400,
        height: 400,
        renderTo: Ext.getBody()    
    });
    
    Ext.create('Ext.Button', {
        text    : 'Add Green Sprite',
        renderTo: Ext.getBody(),
        handler : function() {
            draw.surface.removeAll(true);
            draw.surface.add({
                "type": "path",
                "id": "green",
                "path": "M 66.0,198.0 L 64.0,198.0 L 64.0,193.0 L 66.0,193.0Z",
                "stroke": "#000",
                "stroke-width": 1,
                "fill": "green"
            }).show(true);   
        }
    });
    
    Ext.create('Ext.Button', {
        text    : 'Add Blue Sprite',
        renderTo: Ext.getBody(),
        handler : function() {
            draw.surface.removeAll(true);      
            draw.surface.add({
                "type": "path",
                "id": "blue",                    
                "path": "M 355.0,194.0 L 355.0,187.0 L 363.0,187.0 L 363.0,194.0Z",
                "stroke": "#000",
                "stroke-width": 1,
                "fill": "blue"
            }).show(true);
        }
    });

  3. #3
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,311
    Vote Rating
    109
    LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light

      0  

    Default


    There's a simple workaround - don't reuse sprite ids. Let's say you had a sprite with an id "fixture_1" and then the sprite is removed, don't add a new sprite with the same id even though the old one was destroyed. It appears that Ext is caching the removed sprites (?).

  4. #4
    Sencha User
    Join Date
    May 2012
    Posts
    1
    Vote Rating
    0
    gauravjaincse is on a distinguished road

      0  

    Default Ext Caching

    Ext Caching


    Hi Less,

    Thanx for your explaination. It is very helpful to understand my problem. In my case i am creating sprite id logically. On the basis of that logic i am retrieving my sprite from sprite group. Is there any way by which i can stop ext caching functionality.

Thread Participants: 1