import { zoom , ZoomBehavior , ZoomedElementBaseType } from 'd3-zoom' ; import { event } from 'd3-selection' ; import { BaseChartConfig } from '../../common/types' ; /**
 * Filter which gestures fire which events which will get
 * interpreted as zoom/panning events within the chart.
 */ const filterGestures = ( ) => { if ( event . type === 'wheel' ) { return false ; } if ( event . type === 'mousedown' ) { return event . shiftKey ; } return ! event . ctrlKey && ! event . button ; } ; /**
 * Create Zoom Behavior
 * Handles the translation between the `config` properties and the zoom behavior's properties.
 */ export const createZoomBehavior = ( { movement : { zoomMin , zoomMax } , } ) : ZoomBehavior < ZoomedElementBaseType , unknown > => zoom ( ) . scaleExtent ( [ zoomMin , zoomMax ] ) . filter ( filterGestures ) ;