function ProportionalLayout(context, options) {

        // init
        size = context.size;
        direction = context.direction;
        ratios = options.ratios;
        total = 0;

        // Calculate total sum of ratios
        for (index = 0; index < ratios.length; index++) {
            total += ratios[index];
        }

        // Prepare
        set.size[0] = size[0];
        set.size[1] = size[1];
        set.translate[0] = 0;
        set.translate[1] = 0;

        // Layout renderables
        node = context.next();
        offset = 0;
        index = 0;
        while (node && (index < ratios.length)) {

            // Position renderable
            set.size[direction] = ((size[direction] - offset) / total) * ratios[index];
            set.translate[direction] = offset;
            context.set(node, set);

            // Move to next renderable
            offset += set.size[direction];
            total -= ratios[index];
            index++;
            node = context.next();
        }
    }
function ProportionalLayout(context, options) {

        
        size = context.size;
        direction = context.direction;
        ratios = options.ratios;
        total = 0;

        
        for (index = 0; index < ratios.length; index++) {
            total += ratios[index];
        }

        
        set.size[0] = size[0];
        set.size[1] = size[1];
        set.translate[0] = 0;
        set.translate[1] = 0;

        
        node = context.next();
        offset = 0;
        index = 0;
        while (node && (index < ratios.length)) {

            
            set.size[direction] = ((size[direction] - offset) / total) * ratios[index];
            set.translate[direction] = offset;
            context.set(node, set);

            
            offset += set.size[direction];
            total -= ratios[index];
            index++;
            node = context.next();
        }
    }
function ProportionalLayout ( context , options ) { // init size = context . size ; direction = context . direction ; ratios = options . ratios ; total = 0 ; // Calculate total sum of ratios for ( index = 0 ; index < ratios . length ; index ++ ) { total += ratios [ index ] ; } // Prepare set . size [ 0 ] = size [ 0 ] ; set . size [ 1 ] = size [ 1 ] ; set . translate [ 0 ] = 0 ; set . translate [ 1 ] = 0 ; // Layout renderables node = context . next ( ) ; offset = 0 ; index = 0 ; while ( node && ( index < ratios . length ) ) { // Position renderable set . size [ direction ] = ( ( size [ direction ] - offset ) / total ) * ratios [ index ] ; set . translate [ direction ] = offset ; context . set ( node , set ) ; // Move to next renderable offset += set . size [ direction ] ; total -= ratios [ index ] ; index ++ ; node = context . next ( ) ; } }
Layout function
Layout function