\r
}\r
\r
- public void fastPaint(int horizontal, int vertical)\r
+ int lastsr=0;\r
+ void fastPaint(int horizontal, int vertical)\r
{\r
- if (fastPaint || gg == null)\r
+ if ( fastPaint || gg == null)\r
{\r
- repaint();\r
return;\r
}\r
\r
+\r
+ // Its possible on certain browsers that the call to fastpaint\r
+ // is faster than it can paint, so this check here catches\r
+ // this possibility\r
+ if(lastsr + horizontal != av.startRes)\r
+ {\r
+ horizontal = av.startRes - lastsr;\r
+ }\r
+\r
+ lastsr = av.startRes;\r
+\r
fastPaint = true;\r
gg.copyArea(horizontal * av.charWidth,\r
vertical * av.charHeight,\r
- imgWidth,\r
- imgHeight,\r
+ imgWidth - horizontal * av.charWidth,\r
+ imgHeight - vertical * av.charHeight,\r
-horizontal * av.charWidth,\r
- -vertical * av.charHeight);\r
+ -vertical * av.charHeight);\r
+\r
+\r
\r
int sr = av.startRes, er = av.endRes, ss = av.startSeq, es = av.endSeq,\r
transX = 0, transY = 0;\r
return annotations.adjustPanelHeight();\r
}\r
\r
- synchronized public void drawPanel(Graphics g, int startRes, int endRes, int startSeq, int endSeq, int offset)\r
+ void drawPanel(Graphics g, int startRes, int endRes, int startSeq, int endSeq, int offset)\r
{\r
\r
g.setFont(av.getFont());\r
nextSeq = av.alignment.getSequenceAt(i);\r
\r
sr.drawSequence(g, nextSeq, av.alignment.findAllGroups(nextSeq), startRes, endRes,\r
- (startRes - startRes) * av.charWidth,\r
- offset +\r
- (i - startSeq) * av.charHeight,\r
- av.charWidth, av.charHeight);\r
+ offset + ( (i - startSeq) * av.charHeight));\r
\r
if (av.showSequenceFeatures)\r
{\r
fr.drawSequence(g, nextSeq, startRes, endRes,\r
- offset +(i - startSeq) * av.charHeight,\r
+ offset + ((i - startSeq) * av.charHeight),\r
av.charWidth, av.charHeight);\r
}\r
/// Highlight search Results once all sequences have been drawn\r
}\r
}\r
\r
- /////////////////////////////////////\r
+ //\r
+ /////////////////////////////////////\r
+ // Now outline any areas if necessary\r
+ /////////////////////////////////////\r
+ SequenceGroup group = av.getSelectionGroup();\r
\r
- // Now outline any areas if necessary\r
- /////////////////////////////////////\r
- SequenceGroup group = av.getSelectionGroup();\r
- java.util.Vector groups = av.alignment.getGroups();\r
+ int sx = -1;\r
+ int sy = -1;\r
+ int ex = -1;\r
+ int groupIndex = -1;\r
\r
- int sx = -1, sy = -1, ex = -1;\r
- int groupIndex = -1;\r
- if (group == null && groups.size() > 0)\r
- {\r
- group = (SequenceGroup) groups.elementAt(0);\r
+ if ((group == null) && (av.alignment.getGroups().size() > 0))\r
+ {\r
+ group = (SequenceGroup) av.alignment.getGroups().elementAt(0);\r
groupIndex = 0;\r
- }\r
- if (group != null)\r
- {\r
- do\r
- {\r
- int oldY = -1;\r
- int i = 0;\r
- boolean inGroup = false;\r
- int top = -1;\r
- int bottom = -1;\r
+ }\r
\r
- for (i = startSeq; i < endSeq; i++)\r
- {\r
- sx = (group.getStartRes() - startRes) * av.charWidth;\r
- sy = offset + ((i - startSeq) * av.charHeight);\r
- ex = (((group.getEndRes() + 1) - group.getStartRes()) * av.charWidth) -\r
- 1;\r
+ if ( group != null)\r
+ {\r
+ do\r
+ {\r
+ int oldY = -1;\r
+ int i = 0;\r
+ boolean inGroup = false;\r
+ int top = -1;\r
+ int bottom = -1;\r
+\r
+ for (i = startSeq; i < endSeq; i++)\r
+ {\r
+ sx = (group.getStartRes() - startRes) * av.charWidth;\r
+ sy = offset + ((i - startSeq) * av.charHeight);\r
+ ex = (((group.getEndRes() + 1) - group.getStartRes()) * av.charWidth) -\r
+ 1;\r
+\r
+ if(sx+ex<0 || sx>imgWidth)\r
+ {\r
+ continue;\r
+ }\r
\r
- if(sx+ex<0 || sx>imgWidth)\r
+ if ( (sx <= (endRes-startRes)*av.charWidth) &&\r
+ group.sequences.contains(av.alignment.getSequenceAt(\r
+ i)))\r
+ {\r
+ if (bottom == -1)\r
{\r
- continue;\r
+ if(i == endSeq-1 || // Dont check for i+1 if on the bottom row\r
+ !group.sequences.contains(av.alignment.getSequenceAt(i+1 )))\r
+\r
+ bottom = sy + av.charHeight;\r
}\r
\r
- if ( (sx <= (endRes-startRes)*av.charWidth) &&\r
- group.sequences.contains(av.alignment.getSequenceAt(\r
- i)))\r
+ if (!inGroup)\r
+ {\r
+ if (((top == -1) && (i == 0)) ||\r
+ !group.sequences.contains(\r
+ av.alignment.getSequenceAt(i - 1)))\r
+ {\r
+ top = sy;\r
+ }\r
+\r
+ oldY = sy;\r
+ inGroup = true;\r
+\r
+ if (group == av.getSelectionGroup())\r
+ {\r
+ g.setColor(Color.red);\r
+ }\r
+ else\r
+ {\r
+ g.setColor(group.getOutlineColour());\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if (inGroup)\r
{\r
+ if (sx >= 0 && sx < imgWidth)\r
+ g.drawLine(sx, oldY, sx, sy);\r
\r
- if (bottom == -1)\r
- {\r
- if(i == endSeq-1 || // Dont check for i+1 if on the bottom row\r
- !group.sequences.contains(av.alignment.getSequenceAt(i+1 )))\r
-\r
- bottom = sy + av.charHeight;\r
- }\r
-\r
- if (!inGroup)\r
- {\r
- if (((top == -1) && (i == 0)) ||\r
- !group.sequences.contains(\r
- av.alignment.getSequenceAt(i - 1)))\r
- {\r
- top = sy;\r
- }\r
-\r
- oldY = sy;\r
- inGroup = true;\r
-\r
- if (group == av.getSelectionGroup())\r
- {\r
-\r
- g.setColor(Color.red);\r
- }\r
- else\r
- {\r
- g.setColor(group.getOutlineColour());\r
- }\r
- }\r
- }\r
- else\r
- {\r
- if (inGroup)\r
+ if (sx + ex < imgWidth)\r
+ g.drawLine(sx + ex, oldY, sx + ex, sy);\r
+\r
+ if (sx < 0)\r
{\r
- if (sx >= 0 && sx < imgWidth)\r
- g.drawLine(sx, oldY, sx, sy);\r
-\r
- if (sx + ex < imgWidth)\r
- g.drawLine(sx + ex, oldY, sx + ex, sy);\r
-\r
- if (sx < 0)\r
- {\r
- ex += sx;\r
- sx = 0;\r
- }\r
-\r
- if (sx + ex > imgWidth)\r
- ex = imgWidth;\r
-\r
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
- ex = (endRes - startRes + 1) * av.charWidth;\r
-\r
- if (top != -1)\r
- {\r
- g.drawLine(sx, top, sx + ex, top);\r
- top = -1;\r
- }\r
-\r
- if (bottom != -1)\r
- {\r
- g.drawLine(sx, bottom, sx + ex, bottom);\r
- bottom = -1;\r
- }\r
-\r
- inGroup = false;\r
- }\r
- }\r
- }\r
+ ex += sx;\r
+ sx = 0;\r
+ }\r
\r
- if (inGroup)\r
- {\r
- sy = offset + ( (i - startSeq) * av.charHeight);\r
- if (sx >= 0 && sx < imgWidth)\r
- g.drawLine(sx, oldY, sx, sy);\r
+ if (sx + ex > imgWidth)\r
+ ex = imgWidth;\r
\r
- if (sx + ex < imgWidth)\r
- g.drawLine(sx + ex, oldY, sx + ex, sy);\r
+ else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
+ ex = (endRes - startRes + 1) * av.charWidth;\r
\r
- if (sx < 0)\r
- {\r
- ex += sx;\r
- sx = 0;\r
- }\r
+ if (top != -1)\r
+ {\r
+ g.drawLine(sx, top, sx + ex, top);\r
+ top = -1;\r
+ }\r
\r
- if (sx + ex > imgWidth)\r
- ex = imgWidth;\r
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
- ex = (endRes - startRes + 1) * av.charWidth;\r
+ if (bottom != -1)\r
+ {\r
+ g.drawLine(sx, bottom, sx + ex, bottom);\r
+ bottom = -1;\r
+ }\r
\r
- if (top != -1)\r
- {\r
- g.drawLine(sx, top, sx + ex, top);\r
- top = -1;\r
+ inGroup = false;\r
+ }\r
}\r
+ }\r
\r
- if (bottom != -1)\r
- {\r
- g.drawLine(sx, bottom - 1, sx + ex, bottom - 1);\r
- bottom = -1;\r
- }\r
+ if (inGroup)\r
+ {\r
+ sy = offset + ( (i - startSeq) * av.charHeight);\r
+ if (sx >= 0 && sx < imgWidth)\r
+ g.drawLine(sx, oldY, sx, sy);\r
+\r
+ if (sx + ex < imgWidth)\r
+ g.drawLine(sx + ex, oldY, sx + ex, sy);\r
\r
- inGroup = false;\r
+ if (sx < 0)\r
+ {\r
+ ex += sx;\r
+ sx = 0;\r
}\r
\r
- groupIndex++;\r
+ if (sx + ex > imgWidth)\r
+ ex = imgWidth;\r
+ else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
+ ex = (endRes - startRes + 1) * av.charWidth;\r
\r
- if (groupIndex >= groups.size())\r
+ if (top != -1)\r
{\r
- break;\r
+ g.drawLine(sx, top, sx + ex, top);\r
+ top = -1;\r
}\r
\r
- group = (SequenceGroup) groups.elementAt(groupIndex);\r
- }\r
- while (groupIndex < groups.size());\r
+ if (bottom != -1)\r
+ {\r
+ g.drawLine(sx, bottom - 1, sx + ex, bottom - 1);\r
+ bottom = -1;\r
+ }\r
+\r
+ inGroup = false;\r
+ }\r
+\r
+ groupIndex++;\r
+\r
+ if (groupIndex >= av.alignment.getGroups().size())\r
+ {\r
+ break;\r
+ }\r
+\r
+ group = (SequenceGroup) av.alignment.getGroups().elementAt(groupIndex);\r
+ }\r
+ while (groupIndex < av.alignment.getGroups().size());\r
}\r
}\r
\r