1. #1
    Ext User
    Join Date
    Jan 2008
    Posts
    70
    Vote Rating
    0
    NeonMonk is on a distinguished road

      0  

    Default Ext.layout.SlideLayout - Sliding Card Layout (Shift Fx)

    Ext.layout.SlideLayout - Sliding Card Layout (Shift Fx)


    Hey guys,

    I had a need for a card panel layout that used slide effects.

    See: Live Demo.

    Shift fX config can be set through layoutConfig eg:

    PHP Code:
    layoutConfig: {
        
    easing'easeOut',
        
    duration1,
        
    opacity.1

    The code:
    PHP Code:
    Ext.layout.SlideLayout Ext.extend(Ext.layout.FitLayout, {
        
        
    deferredRender false,

        
        
    renderHidden false,
        
    easing'none',
        
    duration.5,
        
    opacity1,

        
        
    setActiveItem : function(itemInt){
            if (
    typeof(itemInt) == 'string') { itemInt this.container.items.keys.indexOf(itemInt); }
            else if (
    typeof(itemInt) == 'object') { itemInt this.container.items.items.indexOf(itemInt); }
            var 
    item this.container.getComponent(itemInt);
            if(
    this.activeItem != item){
                if(
    this.activeItem){
                    if(
    item && (!item.rendered || !this.isValidParent(itemthis.container))){
                        
    this.renderItem(itemitemIntthis.container.getLayoutTarget()); item.show();
                    }
                    var 
    = [this.container.body.getX() - this.container.body.getWidth(), this.container.body.getX() + this.container.body.getWidth()];
                    
    this.activeItem.el.shift({ durationthis.durationeasingthis.easingopacitythis.opacityx:(this.activeItemNo itemInt s[0] : s[1] )});
                    
    item.el.setY(this.container.body.getY());
                    
    item.el.setX((this.activeItemNo itemInt s[1] : s[0] ));
                    
    item.el.shift({ durationthis.durationeasingthis.easingopacity1x:this.container.body.getX()});
                }
                
    this.activeItemNo itemInt;
                
    this.activeItem item;
                
    this.layout();
            }
        },

        
        
    renderAll : function(cttarget){
            if(
    this.deferredRender){
                
    this.renderItem(this.activeItemundefinedtarget);
            }else{
                
    Ext.layout.CardLayout.superclass.renderAll.call(thiscttarget);
            }
        }
    });
    Ext.Container.LAYOUTS['slide'] = Ext.layout.SlideLayout
    Last edited by NeonMonk; 1 Jan 2009 at 9:51 PM. Reason: Added live demo link

  2. #2
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    neat.

    i tried swapping out TabPanel's CardLayout for a SlideLayout though, and it only worked for the first tab, after which the following error was thrown:
    Code:
    item.el is undefined
    ...
    ...
    [Break on this error] item.el.setY(this.container.body.getY());
    any example / recommended usage?

  3. #3
    Ext User
    Join Date
    Jan 2008
    Posts
    70
    Vote Rating
    0
    NeonMonk is on a distinguished road

      0  

    Default


    SlideLayout wasn't originally compatible with deferredRendering..
    Code has now been updated so if you try it again mystic it should work fine.

  4. #4
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    alritey. works fine now. good stuff

  5. #5
    Sencha User
    Join Date
    Sep 2007
    Location
    Tulsa, Oklahoma
    Posts
    178
    Vote Rating
    1
    ckr is on a distinguished road

      0  

    Thumbs up


    Well Done NeonMonk!

    Another silly demo here.
    Thanks!
    Chuck

  6. #6
    Ext User
    Join Date
    Sep 2008
    Posts
    7
    Vote Rating
    0
    angelko is on a distinguished road

      0  

    Default


    ckr very nice.

  7. #7
    Sencha User
    Join Date
    Sep 2007
    Location
    Tulsa, Oklahoma
    Posts
    178
    Vote Rating
    1
    ckr is on a distinguished road

      0  

    Default


    Updated the demo, so that you can select the type of easing to use, and adjust the duration with the slider.

    Took me a few to find all the easing types, but then found a post where Animal said, Use console in firebug, type in Ext.lib.Easing.... Then look at the object. I 'll be damned if I can find that post again. Anyway, just an addition to the silly demo.
    Thanks!
    Chuck

  8. #8

  9. #9
    Ext User
    Join Date
    Mar 2007
    Posts
    67
    Vote Rating
    0
    ApocalypseCow is on a distinguished road

      0  

    Thumbs up


    nice work - what would be pretty neat now is a plugin for it which displays a "paging" toolbar so you can show the user how many cards there are and how far through the sequence they are and allow them to 'jump' to any card in the sequence etc.

  10. #10
    Sencha User fangzhouxing's Avatar
    Join Date
    Mar 2007
    Posts
    466
    Vote Rating
    1
    fangzhouxing is on a distinguished road

      0  

    Default


    http://slidelayout.freehostia.com/ (live demo) is down?

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