@@ -38,25 +38,26 @@ export class Brush extends Mark {
38
38
const data = this . data ;
39
39
40
40
// compute the scaled channels
41
- if ( x && this . X === undefined ) this . X = X . map ( x ) ;
42
- if ( y && this . Y === undefined ) this . Y = Y . map ( y ) ;
41
+ if ( X && this . X === undefined ) this . X = X . map ( x ) ;
42
+ if ( Y && this . Y === undefined ) this . Y = Y . map ( y ) ;
43
43
( { X, Y} = this ) ;
44
44
45
45
const bounds = [
46
46
[ Math . floor ( marginLeft ) , Math . floor ( marginTop ) ] ,
47
47
[ Math . ceil ( width - marginRight ) , Math . ceil ( height - marginBottom ) ]
48
48
] ;
49
- const brush = ( x && y ? brusher : x ? brusherX : brusherY ) ( )
49
+ const brush = ( X && Y ? brusher : X ? brusherX : brusherY ) ( )
50
50
. extent ( bounds )
51
- . on ( "start brush end" , ( { type, selection, sourceEvent} ) => {
51
+ . on ( "start brush end" , ( event ) => {
52
+ const { type, selection, sourceEvent} = event ;
52
53
let index = filter ( I , X , Y ) ;
53
54
if ( selection ) {
54
- if ( x ) {
55
- const [ x0 , x1 ] = y ? [ selection [ 0 ] [ 0 ] , selection [ 1 ] [ 0 ] ] : selection ;
55
+ if ( X ) {
56
+ const [ x0 , x1 ] = Y ? [ selection [ 0 ] [ 0 ] , selection [ 1 ] [ 0 ] ] : selection ;
56
57
index = index . filter ( i => X [ i ] >= x0 && X [ i ] <= x1 ) ;
57
58
}
58
- if ( y ) {
59
- const [ y0 , y1 ] = x ? [ selection [ 0 ] [ 1 ] , selection [ 1 ] [ 1 ] ] : selection ;
59
+ if ( Y ) {
60
+ const [ y0 , y1 ] = X ? [ selection [ 0 ] [ 1 ] , selection [ 1 ] [ 1 ] ] : selection ;
60
61
index = index . filter ( i => Y [ i ] >= y0 && Y [ i ] <= y1 ) ;
61
62
}
62
63
}
@@ -89,17 +90,17 @@ export class Brush extends Mark {
89
90
if ( svg . __brushes . length === 1 ) {
90
91
if ( this . initialSelection ) {
91
92
const s = this . initialSelection ;
92
- if ( x && y ) {
93
+ if ( X && Y ) {
93
94
const [ x0 , x1 ] = extent ( [ x ( s [ 0 ] [ 0 ] ) , x ( s [ 1 ] [ 0 ] ) ] ) ;
94
95
const [ y0 , y1 ] = extent ( [ y ( s [ 0 ] [ 1 ] ) , y ( s [ 1 ] [ 1 ] ) ] ) ;
95
96
g . call ( brush . move , [
96
97
[ max ( x0 , bounds [ 0 ] [ 0 ] ) , max ( y0 , bounds [ 0 ] [ 1 ] ) ] ,
97
98
[ min ( x1 , bounds [ 1 ] [ 0 ] ) , min ( y1 , bounds [ 1 ] [ 1 ] ) ]
98
99
] ) ;
99
- } else if ( x ) {
100
+ } else if ( X ) {
100
101
const [ x0 , x1 ] = extent ( s . map ( x ) ) ;
101
102
g . call ( brush . move , [ max ( x0 , bounds [ 0 ] [ 0 ] ) , min ( x1 , bounds [ 1 ] [ 0 ] ) ] ) ;
102
- } else if ( y ) {
103
+ } else if ( Y ) {
103
104
const [ y0 , y1 ] = extent ( s . map ( y ) ) ;
104
105
g . call ( brush . move , [ max ( y0 , bounds [ 0 ] [ 1 ] ) , min ( y1 , bounds [ 1 ] [ 1 ] ) ] ) ;
105
106
}
0 commit comments