import { LayerValue } from '../../../../specs' ; import { GlobalChartState } from '../../../../state/chart_state' ; import { createCustomCachedSelector } from '../../../../state/create_selector' ; import { WordcloudViewModel } from '../../layout/types/viewmodel_types' ; import { geometries } from './geometries' ; function getCurrentPointerPosition ( state ) { return state . interactions . pointer . current . position ; } internal export const getPickedShapes = createCustomCachedSelector ( [ geometries , getCurrentPointerPosition ] , ( geoms , pointerPosition ) : WordcloudViewModel [ ] => { const picker = geoms . pickQuads ; const { chartCenter } = geoms ; const x = pointerPosition . x - chartCenter . x ; const y = pointerPosition . y - chartCenter . y ; return picker ( x , y ) ; } ) ; internal export const getPickedShapesLayerValues = createCustomCachedSelector ( [ getPickedShapes ] , ( pickedShapes ) : Array < Array < LayerValue > > => { const elements = pickedShapes . map < Array < LayerValue > > ( ( model ) => { const values = [ ] ; values . push ( { smAccessorValue : '' , groupByRollup : 'Word count' , value : model . data . length , sortIndex : 0 , path : [ ] , depth : 0 , } ) ; return values . reverse ( ) ; } ) ; return elements ; } ) ;