1. #1
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,735
    Vote Rating
    104
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      0  

    Default [2.2.1] Slider animation behaviour suggestion

    [2.2.1] Slider animation behaviour suggestion


    I noticed that when doing processing on a Slider 'changecomplete' event, the event handler interferes with the slider animation and it sometimes doesn't animate at all, other times it just stutters. Maybe the event could be fired after the animation has finished? Maybe the behaviour could be configurable?

    This override does the trick:

    Code:
    Ext.override(Ext.Slider, {
        setValue : function(v, animate, changeComplete){
            v = this.normalizeValue(v);
            if(v !== this.value && this.fireEvent('beforechange', this, v, this.value) !== false){
                this.value = v;
                this.moveThumb(this.translateValue(v), 
                               animate !== false, 
                               function() {
                                   this.fireEvent('change', this, v);
                                   if(changeComplete) {
                                       this.fireEvent('changecomplete', this, v);
                                   }
                               }, this);
            }
        }
    });
    
    Ext.override(Ext.Slider, {
        moveThumb: function(v, animate, cb, scope){
            if(!animate || this.animate === false){
                this.thumb.setLeft(v);
                if (cb){
                    cb.call(scope || this);
                }
            }else{
                this.thumb.shift({
                    left: v, 
                    stopFx: true, 
                    duration:.35,
                    callback : cb,
                    scope : scope || this
                });
            }
        }
    });
    
    Ext.Slider.Vertical.moveThumb = function(v, animate, cb, scope){
        if(!animate || this.animate === false){
            this.thumb.setBottom(v);
            if (cb){
                cb.call(scope || this);
            }
        }else{
            this.thumb.shift({
                bottom: v, 
                stopFx: true, 
                duration:.35,
                callback : cb,
                scope : scope || this
            });
        }
    };

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,501
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Can you highlight your code changes in red, and removed code with strikeout?

  3. #3
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,735
    Vote Rating
    104
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      0  

    Default


    I used bold, not apparent enough I guess

    Code:
    Ext.override(Ext.Slider, {
        setValue : function(v, animate, changeComplete){
            v = this.normalizeValue(v);
            if(v !== this.value && this.fireEvent('beforechange', this, v, this.value) !== false){
                this.value = v;
                this.moveThumb(this.translateValue(v), 
                               animate !== false, 
                               function() {
                                   this.fireEvent('change', this, v);
                                   if(changeComplete) {
                                       this.fireEvent('changecomplete', this, v);
                                   }
                               }, this);
            this.fireEvent('change', this, v);
                    if(changeComplete) {
                         this.fireEvent('changecomplete', this, v);
            } 
            }
        }
    });
    
    Ext.override(Ext.Slider, {
        moveThumb: function(v, animate, cb, scope){
            if(!animate || this.animate === false){
                this.thumb.setLeft(v);
                if (cb){
                    cb.call(scope || this);
                }
            }else{
                this.thumb.shift({
                    left: v, 
                    stopFx: true, 
                    duration:.35,
                    callback : cb,
                    scope : scope || this
                });
            }
        }
    });
    
    Ext.Slider.Vertical.moveThumb = function(v, animate, cb, scope){
        if(!animate || this.animate === false){
            this.thumb.setBottom(v);
            if (cb){
                cb.call(scope || this);
            }
        }else{
            this.thumb.shift({
                bottom: v, 
                stopFx: true, 
                duration:.35,
                callback : cb,
                scope : scope || this
            });
        }
    };

  4. #4
    Ext JS Premium Member stever's Avatar
    Join Date
    Mar 2007
    Posts
    1,406
    Vote Rating
    6
    stever will become famous soon enough stever will become famous soon enough

      0  

    Default


    Quote Originally Posted by mankz View Post
    I used bold, not apparent enough I guess

    Code:
    Ext.override(Ext.Slider, {
        setValue : function(v, animate, changeComplete){
            v = this.normalizeValue(v);
            if(v !== this.value && this.fireEvent('beforechange', this, v, this.value) !== false){
                this.value = v;
                this.moveThumb(this.translateValue(v), 
                               animate !== false, 
                               function() {
                                   this.fireEvent('change', this, v);
                                   if(changeComplete) {
                                       this.fireEvent('changecomplete', this, v);
                                   }
                               }, this);
            this.fireEvent('change', this, v);
                    if(changeComplete) {
                         this.fireEvent('changecomplete', this, v);
            } 
            }
        }
    });
    
    Ext.override(Ext.Slider, {
        moveThumb: function(v, animate, cb, scope){
            if(!animate || this.animate === false){
                this.thumb.setLeft(v);
                if (cb){
                    cb.call(scope || this);
                }
            }else{
                this.thumb.shift({
                    left: v, 
                    stopFx: true, 
                    duration:.35,
                    callback : cb,
                    scope : scope || this
                });
            }
        }
    });
    
    Ext.Slider.Vertical.moveThumb = function(v, animate, cb, scope){
        if(!animate || this.animate === false){
            this.thumb.setBottom(v);
            if (cb){
                cb.call(scope || this);
            }
        }else{
            this.thumb.shift({
                bottom: v, 
                stopFx: true, 
                duration:.35,
                callback : cb,
                scope : scope || this
            });
        }
    };
    I'll have to give this a try. The slider animation has always caused problems for me so I always disable it.

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi