src/render/browser/extend/components/tabheader/index.js
function getScrollVal (rect, node) {
  const left = node.previousSibling
  const right = node.nextSibling
  let scrollVal

  // process left-side element first.
  if (left) {
    const leftRect = left.getBoundingClientRect()
    // only need to compare the value of left.
    if (leftRect.left < rect.left) {
      scrollVal = leftRect.left
      return scrollVal
    }
  }

  if (right) {
    const rightRect = right.getBoundingClientRect()
    // compare the value of right.
    if (rightRect.right > rect.right) {
      scrollVal = rightRect.right - rect.right
      return scrollVal
    }
  }

  // process current node, from left to right.
  const nodeRect = node.getBoundingClientRect()
  if (nodeRect.left < rect.left) {
    scrollVal = nodeRect.left
  }
  else if (nodeRect.right > rect.right) {
    scrollVal = nodeRect.right - rect.right
  }

  return scrollVal
}
function getScrollVal (rect, node) {
  const left = node.previousSibling
  const right = node.nextSibling
  let scrollVal

  // process left-side element first.
  if (left) {
    const leftRect = left.getBoundingClientRect()
    // only need to compare the value of left.
    if (leftRect.left < rect.left) {
      scrollVal = leftRect.left
      return scrollVal
    }
  }

  if (right) {
    const rightRect = right.getBoundingClientRect()
    // compare the value of right.
    if (rightRect.right > rect.right) {
      scrollVal = rightRect.right - rect.right
      return scrollVal
    }
  }

  // process current node, from left to right.
  const nodeRect = node.getBoundingClientRect()
  if (nodeRect.left < rect.left) {
    scrollVal = nodeRect.left
  }
  else if (nodeRect.right > rect.right) {
    scrollVal = nodeRect.right - rect.right
  }

  return scrollVal
}
function getScrollVal ( rect , node ) { const left = node . previousSibling const right = node . nextSibling let scrollVal // process left-side element first. if ( left ) { const leftRect = left . getBoundingClientRect ( ) // only need to compare the value of left. if ( leftRect . left < rect . left ) { scrollVal = leftRect . left return scrollVal } } if ( right ) { const rightRect = right . getBoundingClientRect ( ) // compare the value of right. if ( rightRect . right > rect . right ) { scrollVal = rightRect . right - rect . right return scrollVal } } // process current node, from left to right. const nodeRect = node . getBoundingClientRect ( ) if ( nodeRect . left < rect . left ) { scrollVal = nodeRect . left } else if ( nodeRect . right > rect . right ) { scrollVal = nodeRect . right - rect . right } return scrollVal }
get scroll distance.
get scroll distance .