1. #1
    Sencha User
    Join Date
    Dec 2011
    Location
    Sacramento, California
    Posts
    75
    Vote Rating
    9
    gypsie will become famous soon enough

      0  

    Default Unanswered: Center image xtype

    Unanswered: Center image xtype


    We have image xtype. Image xtype type has "centered" config item. Why in the world when setting centered to true, the most expected behavior isn't happening. That is image being centered. Not even setting layout does this.

    Code:
    layout: {
            type: 'hbox',
            align: 'center',
            pack: 'middle',
    },

  2. #2
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Answers
    132
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    That code snippet from your panel (or container) config right? More code would be helpful to understand what you're getting at.

    I don't know why the image is not centering inside its container.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Location
    Toronto, Canada
    Posts
    92
    Answers
    20
    Vote Rating
    12
    iSmartDevice is on a distinguished road

      0  

    Default


    Have you tried a CSS trick? Here is an example code that might be useful for you.
    Code:
    Ext.define('YourApp.view.ImageGallery', {    
        extend: 'Ext.Container',
        xtype: 'userImageGallery',
        requires: [
            'Ext.Img',
        ],
        
        config:{
            cls: 'galleria',
            
            items:[
                {
                    xtype: 'image',
                },
             ]
           }
    });
    Code:
    // css
    .galleria .x-img {
        background-repeat: no-repeat;
        background-size: auto 100%;
        background-position: center;
    }

Thread Participants: 2