Fixed display bugs when feature is off the screen
authoramwaterhouse <Andrew Waterhouse>
Wed, 9 Feb 2005 15:30:33 +0000 (15:30 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 9 Feb 2005 15:30:33 +0000 (15:30 +0000)
src/jalview/gui/FeatureRenderer.java

index 6e38f1b..d21b39e 100755 (executable)
@@ -30,8 +30,11 @@ public class FeatureRenderer implements RendererI
       int fstart = seq.findIndex(sf.getStart())-1;\r
       int fend = seq.findIndex(sf.getEnd())-1;\r
 \r
-      if(    (fstart>=start&&fstart<=end) || (fend>=start&&fend<=end))\r
+      if(   (fstart<=end && fend>=start)  )\r
       {\r
+        if(fstart<0) // fix for if the feature we have starts before the sequence start,\r
+          fstart = 0;// but the feature end is still valid!!\r
+\r
         if(fstart==fend)\r
         {\r
           g.setColor(Color.red);\r
@@ -49,7 +52,8 @@ public class FeatureRenderer implements RendererI
         {\r
           for (int i = fstart; i <= fend; i++)\r
           {\r
-            g.setColor(Color.blue);\r
+           try{\r
+             g.setColor(Color.blue);\r
             g.fillRect( (i-start) * width, y1, width, height);\r
 \r
             g.setColor(Color.white);\r
@@ -61,6 +65,7 @@ public class FeatureRenderer implements RendererI
                          charOffset + x1 + width * (i-start),\r
                          y1 + height - pady);\r
 \r
+           }catch(Exception ex){System.out.println(i+" "+fstart+" "+fend+" " +sf.getDescription()+" "+seq.getName()+" "+seq.getLength()); }\r
           }\r
         }\r
       }\r