import { event } from 'd3' ; export const getNormalizedOffset = ( value , max ) => value < max / 2 ? 1 - value / ( max / 2 ) : ( - 1 * ( value - max / 2 ) ) / ( max / 2 ) ; export const getSteppedValue = ( value , step ) => value - ( value % step ) ; export const getEventCoords = ( width , height ) => [ Math . max ( 0 , Math . min ( width , event . x ) ) , Math . max ( 0 , Math . min ( height , event . y ) ) , ] ; export const getDragTarget = ( ) => event . sourceEvent . target . __data__ ; export const getValueFromPos = ( pos , posMax , min , max ) => ( pos / posMax ) * ( max - min ) + min ; export const getPosFromValue = ( value , maxPos , min , max ) => ( ( value - min ) / ( max - min ) ) * maxPos ;