for (int i = 0; i < sequences.size(); i++)
{
- if (getSequenceAt(i).getLength() > maxLength)
- {
- maxLength = getSequenceAt(i).getLength();
- }
+ maxLength = Math.max(maxLength, getSequenceAt(i).getLength());
}
-
return maxLength;
}
- /*
- @Override
- public int getWidth()
- {
- final Wrapper temp = new Wrapper();
-
- forEachSequence(new Consumer<SequenceI>()
- {
- @Override
- public void accept(SequenceI s)
- {
- if (s.getLength() > temp.inner)
- {
- temp.inner = s.getLength();
- }
- }
- }, 0, sequences.size() - 1);
-
- return temp.inner;
- }
-
- public static class Wrapper
- {
- public int inner;
- }*/
/**
* DOCUMENT ME!
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
+import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
.visibleToAbsoluteColumn(res);
}
- if (res >= av.getAlignment().getWidth())
- {
- res = av.getAlignment().getWidth() - 1;
- }
+ res = Math.min(res, av.getAlignment().getWidth() - 1);
if (!stretchingGroup)
{
/**
* Action on leaving the panel bounds with mouse drag in progress is to start
- * scrolling the alignment in the direction of the mouse
+ * scrolling the alignment in the direction of the mouse. To restrict
+ * scrolling to left-right (not up-down), the y-value of the mouse position is
+ * replaced with zero.
*/
@Override
public void mouseExited(MouseEvent evt)
{
if (mouseDragging)
{
- ap.getSeqPanel().startScrolling(evt.getPoint());
+ ap.getSeqPanel().startScrolling(new Point(evt.getX(), 0));
}
}
return;
}
- if (res >= av.getAlignment().getWidth())
- {
- res = av.getAlignment().getWidth() - 1;
- }
+ res = Math.min(res, av.getAlignment().getWidth()-1);
if (stretchGroup.getEndRes() == res)
{