function adjustOffset (index) {
    var elements = getElements();

    if (!angular.isNumber(index)) index = ctrl.focusIndex;
    if (!elements.tabs[ index ]) return;
    if (ctrl.shouldCenterTabs) return;
    var tab         = elements.tabs[ index ],
        left        = tab.offsetLeft,
        right       = tab.offsetWidth + left,
        extraOffset = 32;

    // If we are selecting the first tab (in LTR and RTL), always set the offset to 0
    if (index == 0) {
      ctrl.offsetLeft = 0;
      return;
    }

    if (isRtl()) {
      var tabWidthsBefore = calcTabsWidth(Array.prototype.slice.call(elements.tabs, 0, index));
      var tabWidthsIncluding = calcTabsWidth(Array.prototype.slice.call(elements.tabs, 0, index + 1));

      ctrl.offsetLeft = Math.min(ctrl.offsetLeft, fixOffset(tabWidthsBefore));
      ctrl.offsetLeft = Math.max(ctrl.offsetLeft, fixOffset(tabWidthsIncluding - elements.canvas.clientWidth));
    } else {
      ctrl.offsetLeft = Math.max(ctrl.offsetLeft, fixOffset(right - elements.canvas.clientWidth + extraOffset));
      ctrl.offsetLeft = Math.min(ctrl.offsetLeft, fixOffset(left));
    }
  }
function adjustOffset (index) {
    var elements = getElements();

    if (!angular.isNumber(index)) index = ctrl.focusIndex;
    if (!elements.tabs[ index ]) return;
    if (ctrl.shouldCenterTabs) return;
    var tab         = elements.tabs[ index ],
        left        = tab.offsetLeft,
        right       = tab.offsetWidth + left,
        extraOffset = 32;

    
    if (index == 0) {
      ctrl.offsetLeft = 0;
      return;
    }

    if (isRtl()) {
      var tabWidthsBefore = calcTabsWidth(Array.prototype.slice.call(elements.tabs, 0, index));
      var tabWidthsIncluding = calcTabsWidth(Array.prototype.slice.call(elements.tabs, 0, index + 1));

      ctrl.offsetLeft = Math.min(ctrl.offsetLeft, fixOffset(tabWidthsBefore));
      ctrl.offsetLeft = Math.max(ctrl.offsetLeft, fixOffset(tabWidthsIncluding - elements.canvas.clientWidth));
    } else {
      ctrl.offsetLeft = Math.max(ctrl.offsetLeft, fixOffset(right - elements.canvas.clientWidth + extraOffset));
      ctrl.offsetLeft = Math.min(ctrl.offsetLeft, fixOffset(left));
    }
  }
function adjustOffset ( index ) { var elements = getElements ( ) ; if ( ! angular . isNumber ( index ) ) index = ctrl . focusIndex ; if ( ! elements . tabs [ index ] ) return ; if ( ctrl . shouldCenterTabs ) return ; var tab = elements . tabs [ index ] , left = tab . offsetLeft , right = tab . offsetWidth + left , extraOffset = 32 ; // If we are selecting the first tab (in LTR and RTL), always set the offset to 0 if ( index == 0 ) { ctrl . offsetLeft = 0 ; return ; } if ( isRtl ( ) ) { var tabWidthsBefore = calcTabsWidth ( Array . prototype . slice . call ( elements . tabs , 0 , index ) ) ; var tabWidthsIncluding = calcTabsWidth ( Array . prototype . slice . call ( elements . tabs , 0 , index + 1 ) ) ; ctrl . offsetLeft = Math . min ( ctrl . offsetLeft , fixOffset ( tabWidthsBefore ) ) ; ctrl . offsetLeft = Math . max ( ctrl . offsetLeft , fixOffset ( tabWidthsIncluding - elements . canvas . clientWidth ) ) ; } else { ctrl . offsetLeft = Math . max ( ctrl . offsetLeft , fixOffset ( right - elements . canvas . clientWidth + extraOffset ) ) ; ctrl . offsetLeft = Math . min ( ctrl . offsetLeft , fixOffset ( left ) ) ; } }
Forces the pagination to move the focused tab into view.
Forces the pagination to move the focused tab into view .