()
| 21 | |
| 22 | export class LassoSelector extends BaseXYSelector { |
| 23 | render() { |
| 24 | super.render(); |
| 25 | const scale_creation_promise = this.create_scales(); |
| 26 | this.line = d3.line(); |
| 27 | this.all_vertices = {}; |
| 28 | this.lasso_counter = 0; |
| 29 | |
| 30 | const that = this; |
| 31 | Promise.all([this.mark_views_promise, scale_creation_promise]).then(() => { |
| 32 | // Warning: arrow functions actually breaks the drag |
| 33 | const drag = d3 |
| 34 | .drag() |
| 35 | .on('start', () => { |
| 36 | that.drag_start(); |
| 37 | }) |
| 38 | .on('drag', () => { |
| 39 | that.drag_move(); |
| 40 | }) |
| 41 | .on('end', () => { |
| 42 | that.drag_end(); |
| 43 | }); |
| 44 | |
| 45 | d3.select(window).on('keydown', () => { |
| 46 | this.keydown(); |
| 47 | }); |
| 48 | |
| 49 | that.d3el.attr('class', 'lassoselector'); |
| 50 | |
| 51 | //container for mouse events |
| 52 | that.background = that.d3el |
| 53 | .append('rect') |
| 54 | .attr('x', 0) |
| 55 | .attr('y', 0) |
| 56 | .attr('width', that.width) |
| 57 | .attr('height', that.height) |
| 58 | .attr('visibility', 'hidden') |
| 59 | .attr('pointer-events', 'all') |
| 60 | .style('cursor', 'crosshair') |
| 61 | .call(drag); |
| 62 | |
| 63 | that.create_listeners(); |
| 64 | }); |
| 65 | } |
| 66 | |
| 67 | create_listeners() { |
| 68 | super.create_listeners(); |
nothing calls this directly
no test coverage detected