import { ProjectedValues } from '../../../../specs/settings' ; import { createCustomCachedSelector } from '../../../../state/create_selector' ; import { computeSeriesGeometriesSelector } from './compute_series_geometries' ; import { getGeometriesIndexKeysSelector } from './get_geometries_index_keys' ; import { getOrientedProjectedPointerPositionSelector } from './get_oriented_projected_pointer_position' ; internal export const getProjectedScaledValues = createCustomCachedSelector ( [ getOrientedProjectedPointerPositionSelector , computeSeriesGeometriesSelector , getGeometriesIndexKeysSelector ] , ( { x , y , verticalPanelValue , horizontalPanelValue } , { scales : { xScale , yScales } } , geometriesIndexKeys ) : ProjectedValues | undefined => { if ( ! xScale || x === - 1 ) { return ; } const xValue = xScale . invertWithStep ( x , geometriesIndexKeys ) ; if ( ! xValue ) { return ; } return { x : xValue . value , y : [ ... yScales . entries ( ) ] . map ( ( [ groupId , yScale ] ) => ( { value : yScale . invert ( y ) , groupId } ) ) , smVerticalValue : verticalPanelValue , smHorizontalValue : horizontalPanelValue , } ; } ) ;