license import { cssClasses } from '../constants' ; import { MDCTopAppBarFoundation } from '../standard/foundation' ; export class MDCFixedTopAppBarFoundation extends MDCTopAppBarFoundation { /**
     * State variable for the previous scroll iteration top app bar state
     */ private wasScrolled = false ; /**
     * Scroll handler for applying/removing the modifier class on the fixed top app bar.
     */ override handleTargetScroll ( ) { const currentScroll = this . adapter . getViewportScrollY ( ) ; if ( currentScroll <= 0 ) { if ( this . wasScrolled ) { this . adapter . removeClass ( cssClasses . FIXED_SCROLLED_CLASS ) ; this . wasScrolled = false ; } } else { if ( ! this . wasScrolled ) { this . adapter . addClass ( cssClasses . FIXED_SCROLLED_CLASS ) ; this . wasScrolled = true ; } } } } export default MDCFixedTopAppBarFoundation ;