license import { MDCTabScrollerRTL } from './rtl-scroller' ; import { MDCTabScrollerAnimation , MDCTabScrollerHorizontalEdges } from './types' ; export class MDCTabScrollerRTLReverse extends MDCTabScrollerRTL { getScrollPositionRTL ( translateX ) { const currentScrollLeft = this . adapter . getScrollAreaScrollLeft ( ) ; return Math . round ( currentScrollLeft - translateX ) ; } scrollToRTL ( scrollX ) { const currentScrollLeft = this . adapter . getScrollAreaScrollLeft ( ) ; const clampedScrollLeft = this . clampScrollValue ( scrollX ) ; return { finalScrollPosition : clampedScrollLeft , scrollDelta : currentScrollLeft - clampedScrollLeft , } ; } incrementScrollRTL ( scrollX ) { const currentScrollLeft = this . adapter . getScrollAreaScrollLeft ( ) ; const clampedScrollLeft = this . clampScrollValue ( currentScrollLeft + scrollX ) ; return { finalScrollPosition : clampedScrollLeft , scrollDelta : currentScrollLeft - clampedScrollLeft , } ; } getAnimatingScrollPosition ( scrollX , translateX ) { return scrollX + translateX ; } private calculateScrollEdges ( ) { const contentWidth = this . adapter . getScrollContentOffsetWidth ( ) ; const rootWidth = this . adapter . getScrollAreaOffsetWidth ( ) ; return { left : contentWidth - rootWidth , right : 0 , } ; } private clampScrollValue ( scrollX ) { const edges = this . calculateScrollEdges ( ) ; return Math . min ( Math . max ( edges . right , scrollX ) , edges . left ) ; } } export default MDCTabScrollerRTLReverse ;