Skip to content

Commit 76e8ffa

Browse files
committed
shorten
1 parent 5214268 commit 76e8ffa

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/marks/brush.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,24 @@ export class Brush extends Mark {
2424
this.currentElement = null;
2525
}
2626
render(index, {x, y}, {x: X, y: Y}, dimensions) {
27-
const {marginLeft, width, marginRight, marginTop, height, marginBottom} = dimensions;
2827
const {ariaLabel, ariaDescription, ariaHidden, ...options} = this;
29-
const left = marginLeft;
30-
const top = marginTop;
31-
const right = width - marginRight;
32-
const bottom = height - marginBottom;
33-
const mark = this;
28+
const {marginLeft, width, marginRight, marginTop, height, marginBottom} = dimensions;
29+
const brush = this;
3430
const g = create("svg:g")
3531
.call(applyIndirectStyles, {ariaLabel, ariaDescription, ariaHidden})
3632
.call((X && Y ? brusher : X ? brusherX : brusherY)()
37-
.extent([[left, top], [right, bottom]])
33+
.extent([[marginLeft, marginTop], [width - marginRight, height - marginBottom]])
3834
.on("start brush end", function(event) {
3935
const {type, selection} = event;
4036
// For faceting, when starting a brush in a new facet, clear the
4137
// brush and selection on the old facet. In the future, we might
4238
// allow independent brushes across facets by disabling this?
43-
if (type === "start" && mark.currentElement !== this) {
44-
if (mark.currentElement !== null) {
45-
select(mark.currentElement).call(event.target.clear, event);
46-
mark.currentElement.selection = null;
39+
if (type === "start" && brush.currentElement !== this) {
40+
if (brush.currentElement !== null) {
41+
select(brush.currentElement).call(event.target.clear, event);
42+
brush.currentElement.selection = null;
4743
}
48-
mark.currentElement = this;
44+
brush.currentElement = this;
4945
}
5046
let S = null;
5147
if (selection) {

0 commit comments

Comments
 (0)