@@ -28,7 +28,7 @@ export class Brush extends Mark {
28
28
) ;
29
29
this . currentElement = null ;
30
30
}
31
- render ( index , scales , { x : X , y : Y } , dimensions ) {
31
+ render ( index , { x , y } , { x : X , y : Y } , dimensions ) {
32
32
const { marginLeft, width, marginRight, marginTop, height, marginBottom} = dimensions ;
33
33
const { ariaLabel, ariaDescription, ariaHidden, ...options } = this ;
34
34
const left = marginLeft ;
@@ -56,11 +56,13 @@ export class Brush extends Mark {
56
56
if ( selection ) {
57
57
S = index ;
58
58
if ( X ) {
59
- const [ x0 , x1 ] = Y ? [ selection [ 0 ] [ 0 ] , selection [ 1 ] [ 0 ] ] : selection ;
59
+ let [ x0 , x1 ] = Y ? [ selection [ 0 ] [ 0 ] , selection [ 1 ] [ 0 ] ] : selection ;
60
+ if ( x . bandwidth ) x0 -= x . bandwidth ( ) ;
60
61
S = S . filter ( i => x0 <= X [ i ] && X [ i ] <= x1 ) ;
61
62
}
62
63
if ( Y ) {
63
- const [ y0 , y1 ] = X ? [ selection [ 0 ] [ 1 ] , selection [ 1 ] [ 1 ] ] : selection ;
64
+ let [ y0 , y1 ] = X ? [ selection [ 0 ] [ 1 ] , selection [ 1 ] [ 1 ] ] : selection ;
65
+ if ( y . bandwidth ) y0 -= y . bandwidth ( ) ;
64
66
S = S . filter ( i => y0 <= Y [ i ] && Y [ i ] <= y1 ) ;
65
67
}
66
68
}
0 commit comments