import { Dimensions } from '../dimensions.interface' ; import { AlignmentTypes } from '../alignment-types.enum' ; import { horizontalPosition } from '../horizontal-position/horizontal-position.util' ; param elDimensions param popoverDimensions param alignment returns export const calculateHorizontalAlignment = ( elDimensions , popoverDimensions , alignment ) : number => { let result = horizontalPosition ( elDimensions , popoverDimensions , alignment ) ; if ( result + popoverDimensions . width > window . innerWidth ) { result = window . innerWidth - popoverDimensions . width ; } return result ; } ;