av.getRanges().addPropertyChangeListener(this);
- // without this the overview window does not size to fit the overview canvas
- // BH - no,no! - This does not include the progressPanel!
- // BH the problem was that OverviewCanvas.setPreferredSize() had not been set.
- // setPreferredSize(new Dimension(od.getWidth(), od.getHeight()));
-
addComponentListener(new ComponentAdapter()
{
@Override
public void componentResized(ComponentEvent evt)
{
- int ph = (progressPanel.getParent() == null ? 0
- : progressPanel.getHeight());
- // Resize is called on the initial display of the overview.
- // This code adjusts sizes to account for the progress bar if it has not
- // already been accounted for, which triggers another resize call for
- // the correct sizing, at which point the overview image is updated.
- // (This avoids a double recalculation of the image.)
- if (getWidth() == od.getWidth()
- && getHeight() == od.getHeight() + ph)
- {
- updateOverviewImage();
- }
- else
- {
- int w = getWidth();
- int h = getHeight();
- if ((w > 0) && (h > 0))
- {
- if (dim != null)
- {
- dim.setSize(w, h - ph);
- }
- od.setWidth(w);
- od.setHeight(h - ph);
- repaint();
- }
- // BH 2019.07.29 this is unnecessary -- it is what layout managers are
- // for:
- // setPreferredSize(new Dimension(od.getWidth(), od.getHeight() +
- // ph));
- }
+ resizePanel();
}
-
});
addMouseMotionListener(new MouseMotionAdapter()
Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
}
}
-
});
addMouseListener(new MouseAdapter()
@Override
public void mousePressed(MouseEvent evt)
{
-
if (Platform.isWinRightButton(evt))
{
showPopupMenu(evt);
{
draggingBox = false;
}
-
});
+ }
- /*
- * Javascript does not call componentResized on initial display,
- * so do the update here
- */
- if (Platform.isJS())
+ protected void resizePanel()
+ {
+ int ph = (progressPanel.getParent() == null ? 0
+ : progressPanel.getHeight());
+ // Resize is called on the initial display of the overview.
+ // This code adjusts sizes to account for the progress bar if it has not
+ // already been accounted for, which triggers another resize call for
+ // the correct sizing, at which point the overview image is updated.
+ // (This avoids a double recalculation of the image.)
+ if (getWidth() == od.getWidth() && getHeight() == od.getHeight() + ph)
+ {
+ if (canvas.lastMiniMe == null)
+ {
+ updateOverviewImage();
+ }
+ }
+ else
{
- updateOverviewImage();
+ int w = getWidth();
+ int h = getHeight();
+ if ((w > 0) && (h > 0))
+ {
+ if (dim != null)
+ {
+ dim.setSize(w, h - ph);
+ }
+ od.setWidth(w);
+ od.setHeight(h - ph);
+ updateOverviewImage();
+ }
}
}
}
- /*
+ /**
* Displays the popup menu and acts on user input
*/
protected void showPopupMenu(MouseEvent e)
popup.show(this, e.getX(), e.getY());
}
- /*
- * Toggle overview display between showing hidden columns and hiding hidden columns
+ /**
+ * Toggle overview display between showing hidden columns and hiding hidden
+ * columns
*/
protected void toggleHiddenColumns()
{
}
/**
- * Updates the overview image when the related alignment panel is updated
+ * Updates the overview image when the related alignment panel is updated.
+ *
+ * Cases:
+ *
+ * AlignFrame.setFeatureGroupState
+ *
+ * AlignmentPanel.paintAlignment(true,...) (117 references)
+ *
+ * OverviewPanel..componentResized() OverviewPanel.toggleHiddenColumns()
+ *
+ * PopupMenu for action.reveal_sequences, action.reveal_all
+ *
+ * SliderPanel.mouseReleased()
+ *
*/
public void updateOverviewImage()
{
{
if (canvas != null)
{
+ setBoxPosition();
canvas.draw(av.isShowSequenceFeatures(),
(av.isShowAnnotation()
&& av.getAlignmentConservationAnnotation() != null),
ap.getFeatureRenderer());
- setBoxPosition();
}
}