@@ -301,20 +301,20 @@ function brush(dim) {
301
301
if ( ++ this . active === 1 ) this . state . emitter = this , this . starting = true ;
302
302
return this ;
303
303
} ,
304
- start : function ( event ) {
305
- if ( this . starting ) this . starting = false , this . emit ( "start" , event ) ;
304
+ start : function ( event , mode ) {
305
+ if ( this . starting ) this . starting = false , this . emit ( "start" , event , mode ) ;
306
306
else this . emit ( "brush" , event ) ;
307
307
return this ;
308
308
} ,
309
- brush : function ( event ) {
310
- this . emit ( "brush" , event ) ;
309
+ brush : function ( event , mode ) {
310
+ this . emit ( "brush" , event , mode ) ;
311
311
return this ;
312
312
} ,
313
- end : function ( event ) {
314
- if ( -- this . active === 0 ) delete this . state . emitter , this . emit ( "end" , event ) ;
313
+ end : function ( event , mode ) {
314
+ if ( -- this . active === 0 ) delete this . state . emitter , this . emit ( "end" , event , mode ) ;
315
315
return this ;
316
316
} ,
317
- emit : function ( type , event ) {
317
+ emit : function ( type , event , mode ) {
318
318
var d = select ( this . that ) . datum ( ) ;
319
319
listeners . call (
320
320
type ,
@@ -323,6 +323,7 @@ function brush(dim) {
323
323
sourceEvent : event ,
324
324
target : brush ,
325
325
selection : dim . output ( this . state . selection ) ,
326
+ mode,
326
327
dispatch : listeners
327
328
} ) ,
328
329
d
@@ -407,7 +408,7 @@ function brush(dim) {
407
408
}
408
409
409
410
redraw . call ( that ) ;
410
- emit . start ( event ) ;
411
+ emit . start ( event , mode . name ) ;
411
412
412
413
function moved ( event ) {
413
414
for ( const p of event . changedTouches || [ event ] ) {
@@ -485,7 +486,7 @@ function brush(dim) {
485
486
|| selection [ 1 ] [ 1 ] !== s1 ) {
486
487
state . selection = [ [ w1 , n1 ] , [ e1 , s1 ] ] ;
487
488
redraw . call ( that ) ;
488
- emit . brush ( event ) ;
489
+ emit . brush ( event , mode . name ) ;
489
490
}
490
491
}
491
492
@@ -503,7 +504,7 @@ function brush(dim) {
503
504
overlay . attr ( "cursor" , cursors . overlay ) ;
504
505
if ( state . selection ) selection = state . selection ; // May be set by brush.move (on start)!
505
506
if ( empty ( selection ) ) state . selection = null , redraw . call ( that ) ;
506
- emit . end ( event ) ;
507
+ emit . end ( event , mode . name ) ;
507
508
}
508
509
509
510
function keydowned ( event ) {
0 commit comments