X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FSeqPanel.java;h=845004bdb05d1391565f86889238045bd45eb59a;hb=5640ec0623c6d1205e62f9fe15292f32bfdab7d9;hp=d39f93710312c916df8bcbbb04b64bdd1e8610cc;hpb=373ea2f39547c5432fc2922e5d958e1955de14e8;p=jalview.git diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index d39f937..845004b 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -348,8 +348,9 @@ public class SeqPanel extends JPanel */ int findAlignmentColumn(MouseEvent evt) { - return findNearestColumn(evt,true); + return findNearestColumn(evt, true); } + /** * Returns the aligned sequence position (base 0) at the mouse position, or * the closest visible one @@ -364,9 +365,11 @@ public class SeqPanel extends JPanel { return findNearestColumn(evt, false); } - + /** - * @param nearestColumn when false returns negative values for out of bound positions - -1 for scale left/right, <-1 if far to right + * @param nearestColumn + * when false returns negative values for out of bound positions - -1 + * for scale left/right, <-1 if far to right * @return nearest absolute column to mouse pointer */ private int findNearestColumn(MouseEvent evt, boolean nearestColumn) @@ -394,9 +397,12 @@ public class SeqPanel extends JPanel if (x < 0) { // mouse is over left scale - if (!nearestColumn) { + if (!nearestColumn) + { return -1; - } else { + } + else + { x = 0; } } @@ -408,11 +414,14 @@ public class SeqPanel extends JPanel } if (x >= cwidth * charWidth) { - if (!nearestColumn) { + if (!nearestColumn) + { // mouse is over right scale return -1; - } else { - x = cwidth*charWidth -1; + } + else + { + x = cwidth * charWidth - 1; } } @@ -439,7 +448,6 @@ public class SeqPanel extends JPanel res = Math.min(res, av.getRanges().getEndRes()); } - if (av.hasHiddenColumns()) { @@ -2213,32 +2221,85 @@ public class SeqPanel extends JPanel } } + /** + * Responds to a mouse wheel movement by scrolling the alignment + *