From 645c2b050820af4a0cefd91ccb1db62bccb084c2 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 16 Mar 2006 15:17:14 +0000 Subject: [PATCH] Check endres when drawing graphs --- src/jalview/appletgui/AnnotationPanel.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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++) { -- 1.7.10.2