Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danvk committed May 18, 2015
1 parent 79c162d commit b0d8d71
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 100 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
99 changes: 0 additions & 99 deletions cycledash/static/js/examine/components/BioDalliance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down Expand Up @@ -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) ||
Expand All @@ -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;

0 comments on commit b0d8d71

Please sign in to comment.