From: jprocter Date: Mon, 18 Jul 2011 21:25:59 +0000 (+0200) Subject: fixed mouseover problem - still need to deal with flickering (JAL-568 X-Git-Tag: Release_2_7~135 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6f32b630c64f46bc3157f4ec748ef05b985df5bb;p=jalview.git fixed mouseover problem - still need to deal with flickering (JAL-568 and JAL-592) --- diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index 9d19cf3..ebe5785 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -282,6 +282,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme public boolean scrollToPosition(SearchResults results, boolean redrawOverview) { + // do we need to scroll the panel? if (results != null && results.getSize() > 0) { @@ -301,10 +302,11 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme } if (av.applet.debug) { // DEBUG - System.out.println("DEBUG: scroll: start=" + r[0] + /*System.out.println("DEBUG: scroll: start=" + r[0] + " av.getStartRes()=" + av.getStartRes() + " end=" + r[1] + " seq.end=" + seq.getEnd() + " av.getEndRes()=" + av.getEndRes() + " hextent=" + hextent); + */ } int start = r[0]; int end = r[1]; @@ -322,7 +324,9 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme } public boolean scrollTo(int ostart, int end, int seqIndex, boolean scrollToNearest, boolean redrawOverview) { - int start=-1; + int startv, endv, starts, ends, width; + + int start=-1; if (av.hasHiddenColumns) { start = av.getColumnSelection().findColumnPosition(ostart); @@ -334,10 +338,37 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme // don't scroll - position isn't visible return false; } - } } - if (!av.wrapAlignment) - { + } + else + { + start = ostart; + } + if (!av.wrapAlignment) + { + /* + int spos=av.getStartRes(),sqpos=av.getStartSeq(); + if ((startv = av.getStartRes()) >= start) + { + spos=start-1; +// seqIn +// setScrollValues(start - 1, seqIndex); + } + else if ((endv = av.getEndRes()) <= end) + { +// setScrollValues(spos=startv + 1 + end - endv, seqIndex); + spos=startv + 1 + end - endv; + } + else if ((starts = av.getStartSeq()) > seqIndex) + { + setScrollValues(av.getStartRes(), seqIndex); + } + else if ((ends = av.getEndSeq()) <= seqIndex) + { + setScrollValues(av.getStartRes(), starts + seqIndex - ends + 1); + } + + /* */ if ((av.getStartRes() > end) || (av.getEndRes() < start) || ((av.getStartSeq() > seqIndex) || (av.getEndSeq() < seqIndex))) @@ -359,8 +390,9 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme seqIndex = 0; } } + // System.out.println("trying to scroll to: "+start+" "+seqIndex); setScrollValues(start, seqIndex); - } + }/**/ } else { @@ -463,6 +495,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme annotationSpaceFillerHolder.setSize(new Dimension(e.width, height)); annotationPanelHolder.setSize(new Dimension(d.width, height)); seqPanelHolder.setSize(d.width,seqandannot-height); + seqPanel.seqCanvas.setSize(d.width, seqPanel.seqCanvas.getSize().height); int s=apvscroll.getValue(); if (s>mheight-height) { @@ -562,9 +595,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme { width = av.getColumnSelection().findColumnPosition(width); } - - av.setStartRes(x); - av.setEndRes((x + (seqPanel.seqCanvas.getSize().width / av.charWidth)) - 1); + if (x<0) { x = 0; }; hextent = seqPanel.seqCanvas.getSize().width / av.charWidth; vextent = seqPanel.seqCanvas.getSize().height / av.charHeight; @@ -581,6 +612,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme if ((hextent + x) > width) { + System.err.println("hextent was "+hextent+" and x was "+x); + x = width - hextent; } @@ -596,6 +629,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme if (x < 0) { + System.err.println("x was "+x); x = 0; } @@ -608,6 +642,9 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme } av.setEndSeq(endSeq); + av.setStartRes(x); + av.setEndRes((x + (seqPanel.seqCanvas.getSize().width / av.charWidth)) - 1); + hscroll.setValues(x, hextent, 0, width); vscroll.setValues(y, vextent, 0, height);