Skip to content
Snippets Groups Projects
Commit 2bb6e093 authored by tcarver's avatar tcarver
Browse files

speed up mouse over

parent edeac26a
No related branches found
No related tags found
No related merge requests found
...@@ -701,7 +701,6 @@ public class VCFview extends JPanel ...@@ -701,7 +701,6 @@ public class VCFview extends JPanel
public void mouseMoved(MouseEvent e) public void mouseMoved(MouseEvent e)
{ {
findVariantAtPoint(e.getPoint()); findVariantAtPoint(e.getPoint());
int thisHgt = HEIGHT; int thisHgt = HEIGHT;
if (thisHgt < 5) if (thisHgt < 5)
thisHgt = 15; thisHgt = 15;
...@@ -1204,11 +1203,8 @@ public class VCFview extends JPanel ...@@ -1204,11 +1203,8 @@ public class VCFview extends JPanel
return scrollBar.getValue(); return scrollBar.getValue();
} }
protected boolean showVariant(VCFRecord record, FeatureVector features, int basePosition, boolean vcf_v4) protected boolean showVariant(VCFRecord record, FeatureVector features, int basePosition, boolean vcf_v4)
{ {
if(!showDeletions && record.getAlt().isDeletion(vcf_v4)) if(!showDeletions && record.getAlt().isDeletion(vcf_v4))
return false; return false;
...@@ -1447,12 +1443,18 @@ public class VCFview extends JPanel ...@@ -1447,12 +1443,18 @@ public class VCFview extends JPanel
private void findVariantAtPoint(Point mousePoint) private void findVariantAtPoint(Point mousePoint)
{ {
float pixPerBase = getPixPerBaseByWidth(); float pixPerBase = getPixPerBaseByWidth();
int start = getBaseAtStartOfView(); int startBase = getBaseAtStartOfView();
int end = start+nbasesInView; int start = startBase + (int)(mousePoint.getX()/pixPerBase) - 20;
int end = start+20;
FeatureVector features = getCDSFeaturesInRange(start, end); FeatureVector features = getCDSFeaturesInRange(start, end);
for (int i = 0; i < vcfReaders.length; i++) for (int i = 0; i < vcfReaders.length; i++)
{ {
int ypos = getYPostion(i);
if(mousePoint.getY() > ypos &&
mousePoint.getY() < ypos-LINE_HEIGHT)
continue;
if(concatSequences) if(concatSequences)
{ {
String[] contigs = vcfReaders[0].getSeqNames(); String[] contigs = vcfReaders[0].getSeqNames();
...@@ -1472,7 +1474,7 @@ public class VCFview extends JPanel ...@@ -1472,7 +1474,7 @@ public class VCFview extends JPanel
if(thisStart < 1) if(thisStart < 1)
thisStart = 1; thisStart = 1;
int thisEnd = end - offset; int thisEnd = end - offset;
searchRegion(contigs[j], thisStart, thisEnd, i, mousePoint, features, start, pixPerBase); searchRegion(contigs[j], thisStart, thisEnd, i, mousePoint, features, startBase, pixPerBase);
} }
} }
} }
...@@ -1481,7 +1483,7 @@ public class VCFview extends JPanel ...@@ -1481,7 +1483,7 @@ public class VCFview extends JPanel
int thisStart = start; int thisStart = start;
if(thisStart < 1) if(thisStart < 1)
thisStart = 1; thisStart = 1;
searchRegion(chr, thisStart, end, i, mousePoint, features, start, pixPerBase); searchRegion(chr, thisStart, end, i, mousePoint, features, startBase, pixPerBase);
} }
} }
} }
...@@ -1494,7 +1496,9 @@ public class VCFview extends JPanel ...@@ -1494,7 +1496,9 @@ public class VCFview extends JPanel
{ {
VCFRecord bcfRecord; VCFRecord bcfRecord;
while((bcfRecord = vcfReaders[i].getNextRecord(chr, sbeg, send)) != null) while((bcfRecord = vcfReaders[i].getNextRecord(chr, sbeg, send)) != null)
{
isMouseOver(mousePoint, bcfRecord, features, i, start, pixPerBase, vcfReaders[i].isVcf_v4()); isMouseOver(mousePoint, bcfRecord, features, i, start, pixPerBase, vcfReaders[i].isVcf_v4());
}
} }
catch (IOException e) catch (IOException e)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment