Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    5
    Vote Rating
    0
    yui-ext is cool is on a distinguished road

      0  

    Default [INVALID-373] Animation callback scope set to config object instead of config.scope

    [INVALID-373] Animation callback scope set to config object instead of config.scope


    Sencha Touch version tested:
    • 0.96

    Platform tested against:
    • iOS 3.x
    • iOS 4
    • Android 2.1
    • Android 2.2

    Description:
    • In the onTransitionEnd callback function (ext-touch-debug.js line 10276 v .96), the scope for the "after" config callback function is being set to the actual config object instead of the config.scope (line 10303). I can't imagine why the callback scope would be set to the actual config object? if you pass a config with an 'after' callback and scope to the config of run() method, the scope is correctly set:
    Code:
    var opts2 = { 
    scope: { 'test': 'test'}, 
    after: function() { console.log(this); } 
    };
    new Ext.Anim(opts).run(el, opts2);
    Description:
    Code:
    ...
       if (me.config.after) {
                me.config.after.call(config, el, config);
            }
    
            if (o.after) {
                o.after.call(config.scope || me, el, config);
            }
    ...
    Code to reproduce:
    Code:
    var el = Ext.getBody().createChild({
                style: 'background-color: red; width: 20px; height: 20px; top:150px; position:absolute; opacity: 0.0001;'
            });
    var opts = {
    scope: { 'test': 'test' },
    autoClear: false,
    before: function(el){  this.to = { 'opacity': '1' }; },
    after: function() { console.log('Anim callback'); console.log(this); }
    };
    
    var opts2 = { 
    scope: { 'test': 'scope from run config' },
    after: function() { console.log('run callback'); console.log(this); } 
    };
    new Ext.Anim(opts).run(el, opts2);
    Possible fix:
    Code:
    ...
       if (me.config.after) {
                me.config.after.call(config.scope || me, el, config);
            }
    
            if (o.after) {
                o.after.call(config.scope || me, el, config);
            }
    ...
    Additional Question:
    Why are there 2 places you can set the callback for an animation?
    Is there a preferred place to put the callback?

  2. #2
    Sencha - GXT Dev Team BrendanC's Avatar
    Join Date
    Aug 2010
    Posts
    534
    Vote Rating
    3
    BrendanC is on a distinguished road

      0  

    Default


    Thanks for the bug report. The team is reviewing your suggestion and they will let you know what they decide.

  3. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,987
    Vote Rating
    649
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Though I didn't write this code, I think I can see the intent. Also note that the same applies for before as well.

    The before/after for the anim are about setting up any initial values on the animation itself, for example if you look at one of the preset animations, you see it's setting the from/to for the animation to actually do anything. The before/after on the config are intended for any ~other~ things, for example if you wanted to chain events or do something once the animation has finished.

    I think it's more a documentation issue that needs to be cleared up, because the intent is definitely to set the scope to the animation for both of the before/after on the anim.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  4. #4
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    9
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    I'm not sure why this is written this way, but are you seeing an actual bug? Adding scope works correctly for your before/after callback functions.
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  5. #5
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    9
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    Closed this as no actual bug appears to be present.
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

Similar Threads

  1. Where to set transition type in setCard with anim config object?
    By Bucs in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 24 Sep 2010, 5:19 AM
  2. [SOLVED] Scope problem in Ext.Window config
    By caerolus in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 8 Aug 2008, 10:43 AM
  3. callback function and scope
    By dddu88 in forum Ext 2.x: Help & Discussion
    Replies: 10
    Last Post: 18 Nov 2007, 11:11 AM
  4. How to keep scope in selectPath callback?
    By mherger in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 8 Aug 2007, 11:33 PM

Thread Participants: 3

Tags for this Thread