@@ -78,7 +78,7 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) {
78
78
this . _zoomScale = [ 1 , Infinity ] ;
79
79
this . _zoomOutRestrict = true ;
80
80
81
- this . _zoom = zoom ( ) . on ( 'zoom' , ( ) => this . _onZoom ( ) ) ;
81
+ this . _zoom = zoom ( ) . on ( 'zoom' , evt => this . _onZoom ( evt ) ) ;
82
82
this . _nullZoom = zoom ( ) . on ( 'zoom' , null ) ;
83
83
this . _hasBeenMouseZoomable = false ;
84
84
this . _ignoreZoomEvents = false ; // ignore when carrying out programmatic zoom operations
@@ -934,7 +934,7 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) {
934
934
935
935
renderBrush ( g , doTransition ) {
936
936
if ( this . _brushOn ) {
937
- this . _brush . on ( 'start brush end' , ( ) => this . _brushing ( ) ) ;
937
+ this . _brush . on ( 'start brush end' , evt => this . _brushing ( evt ) ) ;
938
938
939
939
// To retrieve selection we need self._gBrush
940
940
this . _gBrush = g . append ( 'g' )
@@ -974,12 +974,17 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) {
974
974
return ! brushSelection || brushSelection [ 1 ] <= brushSelection [ 0 ] ;
975
975
}
976
976
977
- _brushing ( ) {
977
+ _brushing ( evt ) {
978
978
if ( this . _ignoreBrushEvents ) {
979
979
return ;
980
980
}
981
981
982
- let brushSelection = event . selection ;
982
+ // d3@v 5 compatibility
983
+ if ( event ) {
984
+ evt = event ;
985
+ }
986
+
987
+ let brushSelection = evt . selection ;
983
988
if ( brushSelection ) {
984
989
brushSelection = brushSelection . map ( this . x ( ) . invert ) ;
985
990
}
@@ -1261,13 +1266,18 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) {
1261
1266
}
1262
1267
}
1263
1268
1264
- _onZoom ( ) {
1269
+ _onZoom ( evt ) {
1265
1270
// ignore zoom events if it was caused by a programmatic change
1266
1271
if ( this . _ignoreZoomEvents ) {
1267
1272
return ;
1268
1273
}
1269
1274
1270
- const newDomain = event . transform . rescaleX ( this . _origX ) . domain ( ) ;
1275
+ // d3@v 5 compatibility
1276
+ if ( event ) {
1277
+ evt = event ;
1278
+ }
1279
+
1280
+ const newDomain = evt . transform . rescaleX ( this . _origX ) . domain ( ) ;
1271
1281
this . focus ( newDomain , false ) ;
1272
1282
}
1273
1283
0 commit comments