1
1
import { brush as brusher , brushX as brusherX , brushY as brusherY , create , extent } from "d3" ;
2
- import { filter } from "../defined.js" ;
3
- import { Mark , identity , first , second } from "../mark.js" ;
2
+ import { identity , first , second } from "../options.js" ;
3
+ import { Mark } from "../plot.js" ;
4
+
4
5
const { max, min} = Math ;
5
6
6
7
const defaults = { } ;
8
+
7
9
export class Brush extends Mark {
8
10
constructor ( data , { x = first , y = second , selection, onbrush, ...options } = { } ) {
9
11
super (
@@ -20,7 +22,7 @@ export class Brush extends Mark {
20
22
this . onbrush = onbrush ;
21
23
}
22
24
render (
23
- I ,
25
+ index ,
24
26
{ x, y} ,
25
27
{ x : X , y : Y , picker : J } ,
26
28
{ marginLeft, width, marginRight, marginTop, height, marginBottom}
@@ -37,7 +39,6 @@ export class Brush extends Mark {
37
39
. extent ( bounds )
38
40
. on ( "start brush end" , ( event ) => {
39
41
const { type, selection, sourceEvent} = event ;
40
- let index = filter ( I , X , Y ) ;
41
42
if ( selection ) {
42
43
if ( X ) {
43
44
const [ x0 , x1 ] = Y ? [ selection [ 0 ] [ 0 ] , selection [ 1 ] [ 0 ] ] : selection ;
@@ -64,13 +65,13 @@ export class Brush extends Mark {
64
65
}
65
66
}
66
67
} ) ;
67
-
68
+
68
69
g . call ( brush ) ;
69
-
70
+
70
71
/* 🌶 async
71
72
* wait for the ownerSVGElement to:
72
73
* - send the first signal
73
- * - register the multiple brushes (for faceting)
74
+ * - register the multiple brushes (for faceting)
74
75
*/
75
76
setTimeout ( ( ) => {
76
77
const svg = g . node ( ) . ownerSVGElement ;
@@ -101,7 +102,7 @@ export class Brush extends Mark {
101
102
}
102
103
}
103
104
} , 1 ) ;
104
-
105
+
105
106
return g . node ( ) ;
106
107
}
107
108
}
0 commit comments