export class AnchorPosition { static getFixed ( element , anchor ) { if ( ! element . getClientRects ( ) . length ) { return false ; } let rect = element . getBoundingClientRect ( ) ; if ( typeof rect . top === 'undefined' ) { return false ; } let result = { top : 'auto' , right : 'auto' , bottom : 'auto' , left : 'auto' , } ; if ( anchor . indexOf ( 'right' ) > - 1 ) { result . right = window . innerWidth - rect . right ; } else { result . left = rect . left ; } if ( anchor . indexOf ( 'top' ) > - 1 ) { result . bottom = window . innerHeight - rect . top ; } else { result . top = rect . top + rect . height ; } return result ; } }