From b0d8d7197921674b85d7fc9c901a609a89f6899b Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Mon, 18 May 2015 12:13:54 -0400 Subject: [PATCH] cleanup --- .jshintrc | 2 +- .../js/examine/components/BioDalliance.js | 99 ------------------- 2 files changed, 1 insertion(+), 100 deletions(-) diff --git a/.jshintrc b/.jshintrc index 9879d02..391a3cd 100644 --- a/.jshintrc +++ b/.jshintrc @@ -19,7 +19,7 @@ "d3": true, "_": true, "$": true, - "Browser": true, + "pileup": true, "React": true, // We don't set "node: true" to capture certain issues, e.g. console.log // statements. These globals make up for that. diff --git a/cycledash/static/js/examine/components/BioDalliance.js b/cycledash/static/js/examine/components/BioDalliance.js index 17669e3..db33bdc 100644 --- a/cycledash/static/js/examine/components/BioDalliance.js +++ b/cycledash/static/js/examine/components/BioDalliance.js @@ -111,9 +111,6 @@ var BioDalliance = React.createClass({ sources.push(bamSource('Tumor', 'tumor', this.props.tumorBamPath, this.state.tumorBaiChunks)); } - // BioDalliance steals these events. We just want default browser behavior. - // var guardian = new EventGuardian(HTMLDivElement, ['mousewheel', 'MozMousePixelScroll']); - var pileupEl = this.refs.pileupElement.getDOMNode(); this.browser = pileup.create(pileupEl, { @@ -165,50 +162,11 @@ var BioDalliance = React.createClass({ componentDidMount: function() { this.fetchIndexChunks(); this.update(); - - $(this.refs.inspector.getDOMNode()).on('mousewheel.biodalliance', (e) => { - var $target = $(e.target); - var $tiers = $target.parents('.pileup'); - if ($tiers.length === 0) { - e.preventDefault(); - } - }).on('mousewheel.biodalliance', '.pileup', (e, d) => { - // See http://stackoverflow.com/q/5802467/388951 - var t = $(e.currentTarget); - if (d > 0 && t.scrollTop() === 0) { - e.preventDefault(); - } else { - if (d < 0 && (t.scrollTop() == t.get(0).scrollHeight - t.innerHeight())) { - e.preventDefault(); - } - } - }); - - // This uses a capture-phase event listener so that it gets informed of ESC - // key presses before BioDalliance, which will capture them. We only want - // to bypass the usual event bubbling system for ESC, not for arrow keys. - window.addEventListener('keydown', (e) => { - if (!this.props.isOpen || !this.props.selectedRecord) return; - var isDallianceActive = $(document.activeElement).is('.dalliance'); - - if (e.which == 27 /* esc */) { - e.preventDefault(); - this.props.handleClose(); - } - - if (isDallianceActive) return; - if (e.which == 37 /* left arrow */) { - this.handleLeft(e); - } else if (e.which == 39 /* right arrow */) { - this.handleRight(e); - } - }, true /* capture */); }, componentDidUpdate: function() { this.update(); }, componentWillUnmount: function() { - $(this.props.inspector.getDOMNode()).off('mousewheel.biodalliance'); }, shouldComponentUpdate: function(nextProps, nextState) { return ((nextProps.isOpen != this.props.isOpen) || @@ -217,61 +175,4 @@ var BioDalliance = React.createClass({ }); -// Block any attempt to listen to a set of events on a type of element. -// This is a hack to tame badly-behaved libraries. -var EventGuardian = function(elementClass, inputEvents) { - var events = JSON.parse(JSON.stringify(inputEvents)); - - this.elementClass_ = elementClass; - var realListener = this.elementClass_.prototype.addEventListener; - this.elementClass_.prototype.addEventListener = function(name, meth, useCapture) { - if (events.indexOf(name) >= 0) { - return; - } - return realListener.call(this, name, meth, useCapture); - }; - - this.realListener = realListener; -}; - -EventGuardian.prototype.destroy = function() { - this.elementClass_.prototype.addEventListener = this.realListener_; -}; - - -// Style for visualizing BAM reads. -var bamStyle = [ - { - "zoom": "low", - "style": { - "glyph": "__NONE", - } - }, - { - "zoom": "medium", - "style": { - "glyph": "__NONE", - }, - }, - { - "type": "bam", - "zoom": "high", - "style": { - "glyph": "__SEQUENCE", - "_minusColor": "lightgray", - "_plusColor": "lightgray", - "HEIGHT": 8, - "BUMP": true, - "LABEL": false, - "ZINDEX": 20, - "__INSERTIONS": "no", - "__SEQCOLOR": "mismatch" // "mismatch-all" will label all bases - }, - "_typeRE": {}, - "_labelRE": {}, - "_methodRE": {} - } -]; - - module.exports = BioDalliance;