* Scrolls the header to a given position. * @param position Position to which to scroll. * @returns Information on the current scroll distance and the maximum.
(position: number)
| 668 | * @returns Information on the current scroll distance and the maximum. |
| 669 | */ |
| 670 | private _scrollTo(position: number) { |
| 671 | if (this.disablePagination) { |
| 672 | return {maxScrollDistance: 0, distance: 0}; |
| 673 | } |
| 674 | |
| 675 | const maxScrollDistance = this._getMaxScrollDistance(); |
| 676 | this._scrollDistance = Math.max(0, Math.min(maxScrollDistance, position)); |
| 677 | |
| 678 | // Mark that the scroll distance has changed so that after the view is checked, the CSS |
| 679 | // transformation can move the header. |
| 680 | this._scrollDistanceChanged = true; |
| 681 | this._checkScrollingControls(); |
| 682 | |
| 683 | return {maxScrollDistance, distance: this._scrollDistance}; |
| 684 | } |
| 685 | } |