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;
if (av.hasHiddenColumns())
{
- x = av.getAlignment().getHiddenColumns().adjustForHiddenColumns(x);
+ x = av.getAlignment().getHiddenColumns().visibleToAbsoluteColumn(x);
}
if (x >= av.getAlignment().getWidth())
});
pop.add(item);
- if (av.getAlignment().getHiddenColumns().hasManyHiddenColumns())
+ if (av.getAlignment().getHiddenColumns().hasMultiHiddenColumnRegions())
{
item = new JMenuItem(MessageManager.getString("action.reveal_all"));
item.addActionListener(new ActionListener()
}
/**
- * DOCUMENT ME!
+ * Action on mouseUp is to set the limit of the current selection group (if
+ * there is one) and broadcast the selection
*
* @param evt
- * DOCUMENT ME!
*/
@Override
public void mouseReleased(MouseEvent evt)
{
mouseDragging = false;
+ ap.getSeqPanel().stopScrolling();
+ // todo res calculation should be a method on AlignViewport
int res = (evt.getX() / av.getCharWidth())
+ av.getRanges().getStartRes();
-
if (av.hasHiddenColumns())
{
res = av.getAlignment().getHiddenColumns()
- .adjustForHiddenColumns(res);
- }
-
- if (res >= av.getAlignment().getWidth())
- {
- res = av.getAlignment().getWidth() - 1;
+ .visibleToAbsoluteColumn(res);
}
+ res = Math.min(res, av.getAlignment().getWidth() - 1);
if (!stretchingGroup)
{
int res = (evt.getX() / av.getCharWidth())
+ av.getRanges().getStartRes();
res = Math.max(0, res);
- res = hidden.adjustForHiddenColumns(res);
+ res = hidden.visibleToAbsoluteColumn(res);
res = Math.min(res, av.getAlignment().getWidth() - 1);
min = Math.min(res, min);
max = Math.max(res, max);
{
if (mouseDragging)
{
- ap.getSeqPanel().scrollCanvas(null);
+ mouseDragging = false;
+ ap.getSeqPanel().stopScrolling();
}
}
+ /**
+ * Action on leaving the panel bounds with mouse drag in progress is to start
+ * 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().scrollCanvas(evt);
+ ap.getSeqPanel().startScrolling(new Point(evt.getX(), 0));
}
}
reveal = av.getAlignment().getHiddenColumns()
.getRegionWithEdgeAtRes(res);
- res = av.getAlignment().getHiddenColumns().adjustForHiddenColumns(res);
+ res = av.getAlignment().getHiddenColumns().visibleToAbsoluteColumn(res);
ToolTipManager.sharedInstance().registerComponent(this);
this.setToolTipText(
@Override
public void paintComponent(Graphics g)
{
+ super.paintComponent(g);
+
/*
* shouldn't get called in wrapped mode as the scale above is
* drawn instead by SeqCanvas.drawNorthScale
{
if (hidden.isVisible(sel))
{
- sel = hidden.findColumnPosition(sel);
+ sel = hidden.absoluteToVisibleColumn(sel);
}
else
{
if (av.getShowHiddenMarkers())
{
- Iterator<Integer> it = hidden.getBoundedStartIterator(startx,
+ Iterator<Integer> it = hidden.getStartRegionIterator(startx,
startx + widthx + 1);
while (it.hasNext())
{
|| evt.getPropertyName().equals(ViewportRanges.MOVE_VIEWPORT))
{
// scroll event, repaint panel
- repaint();
+
+ // Call repaint on alignment panel so that repaints from other alignment
+ // panel components can be aggregated. Otherwise performance of the overview
+ // window and others may be adversely affected.
+ av.getAlignPanel().repaint();
}
}