In an angular method I do things on the graph at mouse down which then end at mouse up, together with these things I would like to draw a square and I discovered that with d3 there is brush, so I would like to combine things.
this.svgGraph.on('mousedown', (event: any) => {
//I do things...
event.stopPropagation();
})
this.svgGraph.call(d3.brush()
.filter(event => event.button === 2)
.extent([[0, 0], [400, 400]])
)
this.svgGraph.on('mouseup', (event: any) => {
//I do other things...
})
How can I make the mouse down do my things and draw the square at the same time, and at the mouse up I finish my things and remove the square?