From: amwaterhouse Date: Wed, 9 Feb 2005 15:30:33 +0000 (+0000) Subject: Fixed display bugs when feature is off the screen X-Git-Tag: Release_2_0~687 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8c6a0091158548409984e31ffbb9d52516b95fa5;p=jalview.git Fixed display bugs when feature is off the screen --- diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index 6e38f1b..d21b39e 100755 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -30,8 +30,11 @@ public class FeatureRenderer implements RendererI int fstart = seq.findIndex(sf.getStart())-1; int fend = seq.findIndex(sf.getEnd())-1; - if( (fstart>=start&&fstart<=end) || (fend>=start&&fend<=end)) + if( (fstart<=end && fend>=start) ) { + if(fstart<0) // fix for if the feature we have starts before the sequence start, + fstart = 0;// but the feature end is still valid!! + if(fstart==fend) { g.setColor(Color.red); @@ -49,7 +52,8 @@ public class FeatureRenderer implements RendererI { for (int i = fstart; i <= fend; i++) { - g.setColor(Color.blue); + try{ + g.setColor(Color.blue); g.fillRect( (i-start) * width, y1, width, height); g.setColor(Color.white); @@ -61,6 +65,7 @@ public class FeatureRenderer implements RendererI charOffset + x1 + width * (i-start), y1 + height - pady); + }catch(Exception ex){System.out.println(i+" "+fstart+" "+fend+" " +sf.getDescription()+" "+seq.getName()+" "+seq.getLength()); } } } }