diff --git a/cycledash/static/js/examine/components/ExaminePage.js b/cycledash/static/js/examine/components/ExaminePage.js index 53b23bc..dada96b 100644 --- a/cycledash/static/js/examine/components/ExaminePage.js +++ b/cycledash/static/js/examine/components/ExaminePage.js @@ -39,7 +39,7 @@ var ExaminePage = React.createClass({ }, handleOpenViewer: function(record) { this.props.recordActions.setViewerOpen(true); - this.refs.vcfTable.scrollRecordToTop(record); + // this.refs.vcfTable.scrollRecordToTop(record); }, handleCloseViewer: function() { this.props.recordActions.setViewerOpen(false); @@ -76,61 +76,77 @@ var ExaminePage = React.createClass({ var state = this.state, props = this.props, run = props.vcf; - return ( -
-
-
-
- - {props.comparableVcfs ? - : - null} - -
-
- + + // The pileup viewer still needs to be created, even if it's not visible, + // so that it will pre-fetch the index chunks. + var pileupViewer = ( + + ); + + if (state.isViewerOpen) { + return ( +
+ {pileupViewer} +
+ ); + } else { + return ( +
+
+
+
+ + {props.comparableVcfs ? + : + null} + +
+
+ +
-
-
- +
+ +
+
+ +
+ {pileupViewer}
-
- - -
-
- ); - } + ); + } + } }); module.exports = ExaminePage; diff --git a/cycledash/static/js/examine/components/PileupViewer.js b/cycledash/static/js/examine/components/PileupViewer.js index c9edea2..ca8aad2 100644 --- a/cycledash/static/js/examine/components/PileupViewer.js +++ b/cycledash/static/js/examine/components/PileupViewer.js @@ -180,16 +180,11 @@ var PileupViewer = React.createClass({ componentDidMount: function() { this.fetchIndexChunks(); this.update(); - - var pileupEl = this.refs.pileupElement.getDOMNode(); - $(pileupEl).on('DOMMouseScroll mousewheel', '.pileup', cancelImpotentScrolls); }, componentDidUpdate: function() { this.update(); }, componentWillUnmount: function() { - var pileupEl = this.refs.pileupElement.getDOMNode(); - $(pileupEl).off('mousewheel DOMMouseScroll'); }, shouldComponentUpdate: function(nextProps, nextState) { return ((nextProps.isOpen != this.props.isOpen) || @@ -198,38 +193,4 @@ var PileupViewer = React.createClass({ }); -// This prevents mousewheel events at the top/bottom of an element from -// scrolling parent elements. On Cycledash, it prevents mousewheeling on the -// pileup track from scrolling the entire examine page. -// http://stackoverflow.com/a/16324762/388951 -function cancelImpotentScrolls(ev) { - /* jshint validthis: true */ - var $this = $(this), - scrollTop = this.scrollTop, - scrollHeight = this.scrollHeight, - height = $this.height(), - delta = (ev.type == 'DOMMouseScroll' ? - ev.originalEvent.detail * -40 : - ev.originalEvent.wheelDelta), - up = delta > 0; - - var prevent = function() { - ev.stopPropagation(); - ev.preventDefault(); - ev.returnValue = false; - return false; - }; - - if (!up && -delta > scrollHeight - height - scrollTop) { - // Scrolling down, but this will take us past the bottom. - $this.scrollTop(scrollHeight); - return prevent(); - } else if (up && delta > scrollTop) { - // Scrolling up, but this will take us past the top. - $this.scrollTop(0); - return prevent(); - } -} - - module.exports = PileupViewer;