()
| 562 | } |
| 563 | |
| 564 | create_brush() { |
| 565 | // Function to add new brushes. |
| 566 | const index = this.curr_index; |
| 567 | |
| 568 | const vertical = this.model.get('orientation') == 'vertical'; |
| 569 | const brush: d3.BrushBehavior<any> = (vertical ? d3.brushY() : d3.brushX()) |
| 570 | .on('start', () => { |
| 571 | this.brush_start(); |
| 572 | }) |
| 573 | .on('brush', () => { |
| 574 | this.multi_brush_move(index); |
| 575 | }) |
| 576 | .on('end', () => { |
| 577 | this.multi_brush_end(index); |
| 578 | }); |
| 579 | brush.extent([ |
| 580 | [0, 0], |
| 581 | [this.width, this.height], |
| 582 | ]); |
| 583 | |
| 584 | const new_brush_g: d3.Selection<SVGGElement, any, any, any> = this.d3el |
| 585 | .append('g') |
| 586 | .attr('class', 'selector brushintsel active'); |
| 587 | |
| 588 | new_brush_g |
| 589 | .append('text') |
| 590 | .text(this.get_label(this.curr_index)) |
| 591 | .attr('class', 'brush_text_' + this.curr_index) |
| 592 | .style('display', 'none'); |
| 593 | |
| 594 | if (this.model.get('orientation') == 'vertical') { |
| 595 | new_brush_g.select('text').attr('x', 30); |
| 596 | } else { |
| 597 | new_brush_g.select('text').attr('y', 30); |
| 598 | } |
| 599 | |
| 600 | new_brush_g.call(brush); |
| 601 | |
| 602 | this.color_change(); |
| 603 | this.adjust_rectangle(); |
| 604 | this.reset_handler(new_brush_g); |
| 605 | |
| 606 | this.brushes[this.curr_index] = brush; |
| 607 | this.brush_g[this.curr_index] = new_brush_g; |
| 608 | this.curr_index = this.curr_index + 1; |
| 609 | } |
| 610 | |
| 611 | reset_handler(brush_g) { |
| 612 | const that = this; |
no test coverage detected