Threaded View

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    Cincinnati, OH
    Posts
    8
    Vote Rating
    0
    npenny is on a distinguished road

      0  

    Default Centered Issues

    Centered Issues


    I'm trying to display a large image so that it scales down to the height and width of the Container it resides in. This Container is being instantiated in my Viewport, which is a TabPanel.

    Code:
    Ext.define('App.view.ImagePage', {
        extend: 'Ext.Container',
        alias: 'widget.imagepage',
    
        config: {
            style: 'background:url("resources/bg-image.jpg")'
        },
    
        initialize: function() {
            var imagePanel = Ext.create('Ext.Panel', {
                centered: true,
                html: '<img src="resources/imagepage/image.jpg" />'
            });
            this.setItems(imagePanel);
            console.log('View/ImagePage: Initialized')
        }
    });
    I've attached pictures if you'd like to see. My two problems are:

    1.) Why do I have this space across the bottom of my floating image? It's almost as if there is a padding/margin issue. You can also see the problem if you use 'Ext.Img' instead of 'Ext.Panel':
    Code:
    var imagePanel = Ext.create('Ext.Img', {
        centered: true,
        mode: 'image',
        style: 'border:5px solid black;',
        src: 'resources/imagepage/image.jpg',
    });
    2.) Also, more importantly, why does using 'centered' align, center and scale the panel perfectly horizontally but NOT vertically? It doesn't seem to scale down when the image's vertical size exceeds the Container's. It does recognize the top edge, but not the bottom. Scrolling is not turned on anywhere. Using 'Ext.Img' instead of 'Ext.Panel' behaves identically.

    Please help. I have tried many different styling solutions, but can't seem to get it perfect. If anyone has a recommendation I'm all ears.
    Last edited by npenny; 13 Jun 2012 at 3:59 PM. Reason: Additional info in Problem 2.

Thread Participants: 1

Tags for this Thread