import { each } from '@antv/util' ; import { IAbstractGraph } from '../interface/graph' ; import { G6Event } from '../types' ; export default { getDefaultCfg ( ) { return { } ; } , /**
     * register event handler, behavior will auto bind events
     * for example:
     * return {
     *  click: 'onClick'
     * }
     */ getEvents ( ) { return { } ; } , updateCfg ( cfg ) { Object . assign ( this , cfg ) ; return true ; } , shouldBegin ( ) { return true ; } , shouldUpdate ( ) { return true ; } , shouldEnd ( ) { return true ; } , param graph bind ( graph ) { const { events } = this ; this . graph = graph ; if ( this . type === 'drag-canvas' || this . type === 'brush-select' || this . type === 'lasso-select' ) { graph . get ( 'canvas' ) . set ( 'draggable' , true ) ; } each ( events , ( handler , event ) => { graph . on ( event , handler ) ; } ) ; document . addEventListener ( 'visibilitychange' , ( ) => { this . keydown = false ; } ) ; } , unbind ( graph ) { const { events } = this ; let draggable = graph . get ( 'canvas' ) . get ( 'draggable' ) ; if ( this . type === 'drag-canvas' || this . type === 'brush-select' || this . type === 'lasso-select' ) { graph . get ( 'canvas' ) . set ( 'draggable' , false ) ; } each ( events , ( handler , event ) => { graph . off ( event , handler ) ; } ) ; graph . get ( 'canvas' ) . set ( 'draggable' , draggable ) ; } , get ( val ) { return ( this as any ) [ val ] ; } , set ( key , val ) { ( this as any ) [ key ] = val ; return this ; } , } ;