From: amwaterhouse Date: Thu, 16 Mar 2006 15:17:14 +0000 (+0000) Subject: Check endres when drawing graphs X-Git-Tag: Root_VamJalview_2_07b+~56 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=645c2b050820af4a0cefd91ccb1db62bccb084c2;p=jalview.git Check endres when drawing graphs --- diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 4bc8ed5..92ee3a2 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -556,6 +556,9 @@ public class AnnotationPanel if(sRes>aa.annotations.length) return; + + eRes = Math.min(eRes, aa.annotations.length); + int x = 0; //Adjustment for fastpaint to left @@ -576,17 +579,16 @@ public class AnnotationPanel y2 = (int)(y - (0-min / range)*graphHeight); g.setColor(Color.gray); - g.drawLine(x-av.charWidth,y2,(eRes-sRes+1)*av.charWidth,y2); + g.drawLine(x-av.charWidth,y2,(eRes-sRes)*av.charWidth,y2); if(aa.threshold!=null) { g.setColor(aa.threshold.colour); y2 = (int)(y - ((aa.threshold.value-min) / range)*graphHeight); - g.drawLine(x-av.charWidth,y2,(eRes-sRes+1)*av.charWidth,y2); + g.drawLine(x-av.charWidth,y2,(eRes-sRes)*av.charWidth,y2); } - eRes = Math.min(eRes, aa.annotations.length); for (int j = sRes; j < eRes; j++) { if(aa.annotations[j]==null || aa.annotations[j-1]==null) @@ -610,6 +612,9 @@ public class AnnotationPanel if(sRes>aa.annotations.length) return; + + eRes = Math.min(eRes, aa.annotations.length); + int x=0, y1, y2; float range = max - min; @@ -618,7 +623,7 @@ public class AnnotationPanel { g.setColor(aa.threshold.colour); y2 = (int)(y - ((aa.threshold.value-min) / range)*aa.graphHeight); - g.drawLine(x-av.charWidth,y2,(eRes-sRes+1)*av.charWidth,y2); + g.drawLine(x-av.charWidth,y2,(eRes-sRes)*av.charWidth,y2); } y1 = y2 = y; @@ -630,9 +635,6 @@ public class AnnotationPanel g.drawLine(x,y2,(eRes-sRes+1)*av.charWidth,y2); - eRes = Math.min(eRes, aa.annotations.length-1); - - for (int j = sRes; j < eRes; j++) {