Skip to content

Commit

Permalink
keep the GenomeView from double-click zooming when rapidly closing a …
Browse files Browse the repository at this point in the history
…bunch of tracks with their close buttons
  • Loading branch information
rbuels committed Nov 3, 2012
1 parent 9ab4aa6 commit 7040618
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
9 changes: 6 additions & 3 deletions release-notes.txt
Expand Up @@ -88,8 +88,8 @@
zoom in and out. If ALT is added, it zooms further. Thanks to
Karsten Hokamp for the excellent suggestion.

* Holding SHIFT while scrolling with the arrow keys causes the view
to scroll further.
* Holding SHIFT while scrolling left and right with the arrow keys
causes the view to scroll further.

* Added a `theme` configuration variable to allow changing the
graphical theme to something different from the default "tundra".
Expand All @@ -98,7 +98,10 @@
* Greatly sped up rendering of HTML subfeatures by caching the
heights of subfeature HTML elements.

* Fix bug with the genome view scrolling in response to arrow keys
* Fixed bug in which the genome view executed a double-click zoom when
users rapidly clicked on multiple track 'close' buttons.

* Fixed bug with the genome view scrolling in response to arrow keys
being pressed when typing in the location box.

1.6.5 2012-10-26 12:10:08 America/New_York
Expand Down
17 changes: 17 additions & 0 deletions src/JBrowse/GenomeView.js
Expand Up @@ -653,7 +653,24 @@ GenomeView.prototype.afterSlide = function() {
this.showVisibleBlocks(true);
};

/**
* Suppress double-click events in the genome view for a certain amount of time, default 100 ms.
*/
GenomeView.prototype.suppressDoubleClick = function( /** Number */ time ) {

if( this._noDoubleClick ) {
window.clearTimeout( this._noDoubleClick );
}

var thisB = this;
this._noDoubleClick = window.setTimeout(
function(){ delete thisB._noDoubleClick; },
time || 100
);
};

GenomeView.prototype.doubleClickZoom = function(event) {
if( this._noDoubleClick ) return;
if( this.dragging ) return;
if( "animation" in this ) return;

Expand Down
1 change: 1 addition & 0 deletions src/JBrowse/View/Track/BlockBased.js
Expand Up @@ -148,6 +148,7 @@ return declare( null,
var closeButton = dojo.create('div',{
className: 'track-close-button',
onclick: dojo.hitch(this,function(evt){
this.browser.view.suppressDoubleClick( 100 );
this.browser.publish( '/jbrowse/v1/v/tracks/hide', [this.config]);
evt.stopPropagation();
})
Expand Down

0 comments on commit 7040618

Please sign in to comment.