JAL-3648 resize annotation panel after dragging to resize graph height
[jalview.git] / src / jalview / gui / AnnotationPanel.java
index 16db94c..10fc3cf 100755 (executable)
@@ -629,6 +629,10 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
     mouseDragLastX = -1;
     mouseDragLastY = -1;
     mouseDragging = false;
+    if (dragMode == DragMode.Resize)
+    {
+      ap.adjustAnnotationHeight();
+    }
     dragMode = DragMode.Undefined;
     ap.getScalePanel().mouseReleased(evt);
 
@@ -668,16 +672,25 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
   }
 
   /**
-   * DOCUMENT ME!
+   * Action on starting or continuing a mouse drag. There are two possible
+   * actions:
+   * <ul>
+   * <li>drag up or down on a graphed annotation increases or decreases the
+   * height of the graph</li>
+   * <li>dragging left or right selects the columns dragged across</li>
+   * </ul>
+   * A drag on a graph annotation is treated as column selection if it starts
+   * with more horizontal than vertical movement, and as resize if it starts
+   * with more vertical than horizontal movement. Once started, the drag does
+   * not change mode.
    * 
    * @param evt
-   *          DOCUMENT ME!
    */
   @Override
   public void mouseDragged(MouseEvent evt)
   {
     /*
-     * todo: if dragMode is Undefined:
+     * if dragMode is Undefined:
      * - set to Select if dx > dy
      * - set to Resize if dy > dx
      * - do nothing if dx == dy