function _rotateSelection(distance) {
            var len = self.items.length,
                pos;

            if (self.selectedIndex < 0) {
                // set the initial selection
                pos = (distance > 0) ? distance - 1 : len - 1;

            } else {
                // adjust current selection
                pos = self.selectedIndex;

                // Don't "rotate" until all items have been shown
                if (distance > 0) {
                    if (pos === (len - 1)) {
                        pos = 0;  // wrap
                    } else {
                        pos = Math.min(pos + distance, len - 1);
                    }
                } else {
                    if (pos === 0) {
                        pos = (len - 1);  // wrap
                    } else {
                        pos = Math.max(pos + distance, 0);
                    }
                }
            }

            self._setSelectedIndex(pos);
        }
function _rotateSelection(distance) {
            var len = self.items.length,
                pos;

            if (self.selectedIndex < 0) {
                // set the initial selection
                pos = (distance > 0) ? distance - 1 : len - 1;

            } else {
                // adjust current selection
                pos = self.selectedIndex;

                // Don't "rotate" until all items have been shown
                if (distance > 0) {
                    if (pos === (len - 1)) {
                        pos = 0;  // wrap
                    } else {
                        pos = Math.min(pos + distance, len - 1);
                    }
                } else {
                    if (pos === 0) {
                        pos = (len - 1);  // wrap
                    } else {
                        pos = Math.max(pos + distance, 0);
                    }
                }
            }

            self._setSelectedIndex(pos);
        }
function _rotateSelection ( distance ) { var len = self . items . length , pos ; if ( self . selectedIndex < 0 ) { // set the initial selection pos = ( distance > 0 ) ? distance - 1 : len - 1 ; } else { // adjust current selection pos = self . selectedIndex ; // Don't "rotate" until all items have been shown if ( distance > 0 ) { if ( pos === ( len - 1 ) ) { pos = 0 ; // wrap } else { pos = Math . min ( pos + distance , len - 1 ) ; } } else { if ( pos === 0 ) { pos = ( len - 1 ) ; // wrap } else { pos = Math . max ( pos + distance , 0 ) ; } } } self . _setSelectedIndex ( pos ) ; }
positive distance rotates down; negative distance rotates up
positive distance rotates down ; negative distance rotates up
Rotate the selection to the specified distance.