X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FOverviewPanel.java;h=92451041b77ca2b784d38dd55d9e331c4ad67e72;hb=74d5ca6390288f6cd6cb445cccc728802806a29a;hp=cc647a87b931cf0865601972b3e755dbef6a63dc;hpb=4435c731351c802772dd1355fdb5747cfacd7838;p=jalview.git diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java index cc647a8..9245104 100755 --- a/src/jalview/gui/OverviewPanel.java +++ b/src/jalview/gui/OverviewPanel.java @@ -110,51 +110,13 @@ public class OverviewPanel extends JPanel 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) - { - // BH: resizing is now exceptionally fast. - 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); - updateOverviewImage(); - // 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() @@ -200,7 +162,6 @@ public class OverviewPanel extends JPanel Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); } } - }); addMouseListener(new MouseAdapter() @@ -208,7 +169,6 @@ public class OverviewPanel extends JPanel @Override public void mousePressed(MouseEvent evt) { - if (Platform.isWinRightButton(evt)) { showPopupMenu(evt); @@ -257,17 +217,40 @@ public class OverviewPanel extends JPanel { draggingBox = false; } - }); + } - // /* - // * Javascript does not call componentResized on initial display, - // * so do the update here - // */ - // if (Platform.isJS()) - // { - // updateOverviewImage(); - // } + 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 + { + 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(); + } + } } /** @@ -290,7 +273,7 @@ public class OverviewPanel extends JPanel } - /* + /** * Displays the popup menu and acts on user input */ protected void showPopupMenu(MouseEvent e) @@ -315,8 +298,9 @@ public class OverviewPanel extends JPanel 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() {