()
| 31 | |
| 32 | export class PanZoom extends interaction.Interaction { |
| 33 | render() { |
| 34 | super.render(); |
| 35 | const that = this; |
| 36 | // chrome bug that requires a listener on the parent svg node |
| 37 | // https://github.com/d3/d3-zoom/issues/231#issuecomment-802713799 |
| 38 | this.parent.svg.node().addEventListener('wheel', nop, { passive: false }); |
| 39 | this.d3el |
| 40 | .style('cursor', 'move') |
| 41 | .call( |
| 42 | d3 |
| 43 | .drag() |
| 44 | .on('start', () => { |
| 45 | that.mousedown(); |
| 46 | }) |
| 47 | .on('drag', () => { |
| 48 | that.mousemove(); |
| 49 | }) |
| 50 | .on('end', () => { |
| 51 | that.mouseup(); |
| 52 | }) |
| 53 | ) |
| 54 | .on('wheel', () => { |
| 55 | that.mousewheel(); |
| 56 | }); |
| 57 | this.active = false; |
| 58 | |
| 59 | this.update_scales(); |
| 60 | this.listenTo(this.model, 'change:scales', this.update_scales); |
| 61 | |
| 62 | this.set_ranges(); |
| 63 | this.listenTo(this.parent, 'margin_updated', this.set_ranges); |
| 64 | } |
| 65 | |
| 66 | remove() { |
| 67 | this.parent.svg.node().removeEventListener('wheel', nop); |
nothing calls this directly
no test coverage detected