public/javascripts/yui/carousel/carousel-debug.js
function getCarouselItemPosition(pos) {
        var carousel    = this,
            itemsPerRow = carousel._cols,
            itemsPerCol = carousel._rows,
            page,
            sz,
            isVertical,
            itemsCol,
            itemsRow,
            sentinel,
            delta = 0,
            top,
            left,
            rsz,
            styles = {},
            index = 0,
            itemsTable = carousel._itemsTable,
            items = itemsTable.items,
            loading = itemsTable.loading;

        isVertical = carousel.get("isVertical");
        sz  = getCarouselItemSize.call(carousel,
                isVertical ? "height" : "width");
        rsz = getRevealSize.call(carousel);

        // adjust for items not yet loaded
        while (index < pos) {
            if (!items[index] && !loading[index]) {
                delta++;
            }
            index++;
        }
        pos -= delta;

        if (itemsPerCol) {
            page = this.getPageForItem(pos);
            if (isVertical) {
                itemsRow = Math.floor(pos/itemsPerRow);
                delta = itemsRow;
                top = delta * sz;
                styles.top  = (top + rsz) + "px";

                sz  = getCarouselItemSize.call(carousel, "width");

                itemsCol = pos % itemsPerRow;
                delta = itemsCol;
                left = delta * sz;
                styles.left = left + "px";
            } else {
                itemsCol = pos % itemsPerRow;
                sentinel = (page - 1) * itemsPerRow;
                delta = itemsCol + sentinel;
                left = delta * sz;
                styles.left = (left + rsz) + "px";

                sz  = getCarouselItemSize.call(carousel, "height");

                itemsRow = Math.floor(pos/itemsPerRow);
                sentinel = (page - 1) * itemsPerCol;
                delta = itemsRow - sentinel;
                top = delta * sz;

                styles.top  = top + "px";
            }
        } else {
        if (isVertical) {
            styles.left = 0;
            styles.top  = ((pos * sz) + rsz) + "px";
        } else {
            styles.top  = 0;
            styles.left = ((pos * sz) + rsz) + "px";
        }
        }

        return styles;
    }
function getCarouselItemPosition(pos) {
        var carousel    = this,
            itemsPerRow = carousel._cols,
            itemsPerCol = carousel._rows,
            page,
            sz,
            isVertical,
            itemsCol,
            itemsRow,
            sentinel,
            delta = 0,
            top,
            left,
            rsz,
            styles = {},
            index = 0,
            itemsTable = carousel._itemsTable,
            items = itemsTable.items,
            loading = itemsTable.loading;

        isVertical = carousel.get("isVertical");
        sz  = getCarouselItemSize.call(carousel,
                isVertical ? "height" : "width");
        rsz = getRevealSize.call(carousel);

        // adjust for items not yet loaded
        while (index < pos) {
            if (!items[index] && !loading[index]) {
                delta++;
            }
            index++;
        }
        pos -= delta;

        if (itemsPerCol) {
            page = this.getPageForItem(pos);
            if (isVertical) {
                itemsRow = Math.floor(pos/itemsPerRow);
                delta = itemsRow;
                top = delta * sz;
                styles.top  = (top + rsz) + "px";

                sz  = getCarouselItemSize.call(carousel, "width");

                itemsCol = pos % itemsPerRow;
                delta = itemsCol;
                left = delta * sz;
                styles.left = left + "px";
            } else {
                itemsCol = pos % itemsPerRow;
                sentinel = (page - 1) * itemsPerRow;
                delta = itemsCol + sentinel;
                left = delta * sz;
                styles.left = (left + rsz) + "px";

                sz  = getCarouselItemSize.call(carousel, "height");

                itemsRow = Math.floor(pos/itemsPerRow);
                sentinel = (page - 1) * itemsPerCol;
                delta = itemsRow - sentinel;
                top = delta * sz;

                styles.top  = top + "px";
            }
        } else {
        if (isVertical) {
            styles.left = 0;
            styles.top  = ((pos * sz) + rsz) + "px";
        } else {
            styles.top  = 0;
            styles.left = ((pos * sz) + rsz) + "px";
        }
        }

        return styles;
    }
function getCarouselItemPosition ( pos ) { var carousel = this , itemsPerRow = carousel . _cols , itemsPerCol = carousel . _rows , page , sz , isVertical , itemsCol , itemsRow , sentinel , delta = 0 , top , left , rsz , styles = { } , index = 0 , itemsTable = carousel . _itemsTable , items = itemsTable . items , loading = itemsTable . loading ; isVertical = carousel . get ( "isVertical" ) ; sz = getCarouselItemSize . call ( carousel , isVertical ? "height" : "width" ) ; rsz = getRevealSize . call ( carousel ) ; // adjust for items not yet loaded while ( index < pos ) { if ( ! items [ index ] && ! loading [ index ] ) { delta ++ ; } index ++ ; } pos -= delta ; if ( itemsPerCol ) { page = this . getPageForItem ( pos ) ; if ( isVertical ) { itemsRow = Math . floor ( pos / itemsPerRow ) ; delta = itemsRow ; top = delta * sz ; styles . top = ( top + rsz ) + "px" ; sz = getCarouselItemSize . call ( carousel , "width" ) ; itemsCol = pos % itemsPerRow ; delta = itemsCol ; left = delta * sz ; styles . left = left + "px" ; } else { itemsCol = pos % itemsPerRow ; sentinel = ( page - 1 ) * itemsPerRow ; delta = itemsCol + sentinel ; left = delta * sz ; styles . left = ( left + rsz ) + "px" ; sz = getCarouselItemSize . call ( carousel , "height" ) ; itemsRow = Math . floor ( pos / itemsPerRow ) ; sentinel = ( page - 1 ) * itemsPerCol ; delta = itemsRow - sentinel ; top = delta * sz ; styles . top = top + "px" ; } } else { if ( isVertical ) { styles . left = 0 ; styles . top = ( ( pos * sz ) + rsz ) + "px" ; } else { styles . top = 0 ; styles . left = ( ( pos * sz ) + rsz ) + "px" ; } } return styles ; }
Compute and return the position of a Carousel item based on its
position.

@method getCarouselItemPosition
@param position {Number} The position of the Carousel item.
@private
Compute and return the position of a Carousel item based on its position .