Вход Регистрация
Файл: framework/admin/thirdparty/jlayout/lib/jlayout.flexgrid.js
Строк: 85
<?php
/**
 * @preserve jLayout Flex Grid Layout - JavaScript Layout Algorithms v0.4
 * Based on: http://www.javaworld.com/javaworld/javatips/jw-javatip121.html
 *
 * Licensed under the new BSD License.
 * Copyright 2008-2009, Bram Stein
 * All rights reserved.
 */
/*global jLayout:true */
(function () {
    
jLayout = (typeof jLayout === 'undefined') ? {} : jLayout;

    
// The flex grid has a dependency on the grid layout, so please make
    // sure you include the grid layout manager before the flex grid
    // layout manager.
    
if (typeof jLayout.grid !== 'undefined') {
        
jLayout.flexGrid = function (spec) {
            var 
my = {},
                
that this.grid(specmy);

            function 
zeroArray(al) {
                var 
0;
                for (; 
l+= 1) {
                    
a[i] = 0;
                }
                return 
a;
            }

            function 
typeLayout(type) {
                return function (
container) {
                    var 
000nw 0nh 0,
                        
zeroArray([], my.columns),
                        
zeroArray([], my.rows),
                        
type_size,
                        
insets container.insets();
            
                    for (
0my.items.length+= 1) {
                        
Math.floor(my.columns);
                        
my.columns;
                        
type_size my.items[i][type 'Size']();
                        if (
w[c] < type_size.width) {
                            
w[c] = type_size.width;
                        }
                        if (
h[r] < type_size.height) {
                            
h[r] = type_size.height;
                        }
                    }
                    for (
0my.columns+= 1) {
                        
nw += w[i];
                    }
                    for (
0my.rows+= 1) {
                        
nh += h[i];
                    }
                    return {
                        
widthinsets.left insets.right nw + (my.columns 1) * my.hgap,
                        
heightinsets.top insets.bottom nh + (my.rows 1) * my.vgap
                    
};
                };
            }

            
that.preferred typeLayout('preferred');
            
that.minimum typeLayout('minimum');
            
that.maximum typeLayout('maximum');

            
that.layout = function (container) {
                var 
000,
                    
pd that.preferred(container),
                    
sw container.bounds().width pd.width,
                    
sh container.bounds().height pd.height,
                    
zeroArray([], my.columns),
                    
zeroArray([], my.rows),
                    
insets container.insets(),
                    
insets.left,
                    
insets.top,
                    
d;

                for (
0my.items.length+= 1) {
                    
Math.floor(my.columns);
                    
my.columns;
                    
my.items[i].preferredSize();
                    
d.width sw d.width;
                    
d.height sh d.height;

                    if (
w[c] < d.width) {
                        
w[c] = d.width;
                    }
                    if (
h[r] < d.height) {
                        
h[r] = d.height;
                    }
                }

                for (
0my.columns+= 1) {
                    for (
0insets.topmy.rows+= 1) {
                        
my.columns c;
                        if (
my.items.length) {
                            
my.items[i].bounds({'x'x'y'y'width'w[c], 'height'h[r]});
                            
my.items[i].doLayout();
                        }
                        
+= h[r] + my.vgap;
                    }
                    
+= w[c] + my.hgap;
                }
                return 
container;
            };
            return 
that;
        };
    }
}());
?>
Онлайн: 0
Реклама