From af4cc37834a81c2b5607eff53e05cdc4d1be355e Mon Sep 17 00:00:00 2001
From: tcarver <tjc>
Date: Tue, 18 Feb 2014 16:10:08 +0000
Subject: [PATCH] fixes for view positions

---
 .../artemis/components/alignment/BamView.java | 25 +++++--------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/uk/ac/sanger/artemis/components/alignment/BamView.java b/uk/ac/sanger/artemis/components/alignment/BamView.java
index 04bbb1125..8df3a9b15 100644
--- a/uk/ac/sanger/artemis/components/alignment/BamView.java
+++ b/uk/ac/sanger/artemis/components/alignment/BamView.java
@@ -2687,6 +2687,7 @@ public class BamView extends JPanel
         if(cbStackView.isSelected())
           logMenuItem.setEnabled(false);
         getJspView().setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
+        setViewportBtm();
         repaint();
       }
     });
@@ -3188,31 +3189,18 @@ public class BamView extends JPanel
       public void mouseMoved(MouseEvent e)
       {
         lastMousePoint = e.getPoint();
-        
         int thisHgt = HEIGHT-2;
         if (thisHgt < 5)
           thisHgt = 15;
 
         int y = (int) (e.getY() - jspView.getViewport().getViewRect().getY());
-        Point p = jspView.getViewport().getViewPosition();
-        boolean isVis = topPanel.isVisible();
-        
         if (y < thisHgt)
-        {
           topPanel.setVisible(true);
-          if(!isVis)
-            p.y += topPanel.getHeight();
-        }
         else
         {
-          if (buttonAutoHide.isSelected())
+          if (buttonAutoHide.isSelected() && topPanel.isVisible())
             topPanel.setVisible(false); 
         }
-        
-        if(!showBaseAlignment && topPanel.isVisible())
-          jspView.getViewport().setViewPosition(p);
-        mainPanel.repaint();
-        //mainPanel.revalidate();
       }
     };
     addMouseMotionListener(mouseMotionListener);
@@ -3396,18 +3384,17 @@ public class BamView extends JPanel
         cbLastSelected.setSelected(true);
         cbLastSelected = null;
       }
-      
+
       jspView.setColumnHeaderView(null);
-      
-      if(!isStrandStackView())
+      if(isCoverageView(pixPerBase))
         setViewportBtm();
-      else
+      else if (isStrandStackView())
         setViewportMidPoint();
       showBaseAlignment = false;
       baseQualityColour.setEnabled(false);
       markInsertions.setEnabled(false);
     }
-    
+
     if(scrollBar != null)
     {
       scrollBar.setValues(startValue, nbasesInView, 1, 
-- 
GitLab