jameshadfield / phandango

an interactive viewer for populations of bacterial genomes linked by a phylogeny
http://phandango.net
MIT License
113 stars 27 forks source link

Pan doesn't reach ends of genome #63

Closed simonrharris closed 8 years ago

simonrharris commented 8 years ago

When you pan in phandango it is not possible to get to base 0 or genome-length.

Can be fixed by changing lines 77-80 in genome.js store from:

if (newLeft < 0 || newRight > genomeLength) {
    showHelperMessage('can\'t drag (already at edge of genome)');
    return false;
  }

to:

if ((newLeft < 0 && visibleGenome[0] === 0 ) || (newRight > genomeLength && visibleGenome[1] === genomeLength)) {
    showHelperMessage('can\'t drag (already at edge of genome)');
    return false;
  }
else if (newLeft < 0) {
    newLeft=0;
  }
else if (newRight > genomeLength) {
    newRight=genomeLength;
  }

Or something similar.

Hope that helps

Simon

jameshadfield commented 8 years ago

@simonrharris you need to pull a newer version, that code is OLD!

simonrharris commented 8 years ago

Well it still isn't working on the https://jameshadfield.github.io/JScandy/ version. It's not that it pans past start/end, it's that it doesn't pan to the start/end if you're zoomed in. Try it. Zoom in and drag to the start of the genome. The leftmost genome coordinate will not go to 0.

simonrharris commented 8 years ago

OK, works on http://jameshadfield.github.io/phandango/. Sorry, didn't know that page existed - just had a guess and it works there.