Skip to content

Commit bf140b8

Browse files
committed
brush bandwidth
1 parent 89b8755 commit bf140b8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/marks/brush.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class Brush extends Mark {
2828
);
2929
this.currentElement = null;
3030
}
31-
render(index, scales, {x: X, y: Y}, dimensions) {
31+
render(index, {x, y}, {x: X, y: Y}, dimensions) {
3232
const {marginLeft, width, marginRight, marginTop, height, marginBottom} = dimensions;
3333
const {ariaLabel, ariaDescription, ariaHidden, ...options} = this;
3434
const left = marginLeft;
@@ -56,11 +56,13 @@ export class Brush extends Mark {
5656
if (selection) {
5757
S = index;
5858
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();
6061
S = S.filter(i => x0 <= X[i] && X[i] <= x1);
6162
}
6263
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();
6466
S = S.filter(i => y0 <= Y[i] && Y[i] <= y1);
6567
}
6668
}

0 commit comments

Comments
 (0)