import { Scale } from '../scales' ; import { BrushEndListener , isPointerOverEvent , PointerEvent , PointerOverEvent } from '../specs' ; import { DragState } from '../state/chart_state' ; internal export function isValidPointerOverEvent ( mainScale , event ) { return isPointerOverEvent ( event ) && ( event . unit === undefined || event . unit === mainScale . unit ) ; } internal export interface DragCheckProps { onBrushEnd : BrushEndListener | undefined ; lastDrag : DragState | null ; } internal export function hasDragged ( prevProps , nextProps ) { if ( nextProps === null ) { return false ; } if ( ! nextProps . onBrushEnd ) { return false ; } const prevLastDrag = prevProps !== null ? prevProps . lastDrag : null ; const nextLastDrag = nextProps . lastDrag ; return nextLastDrag !== null && ( prevLastDrag === null || prevLastDrag . end . time !== nextLastDrag . end . time ) ; }