/** * Left Mouse dragging drags end of feature if drag type right or left boundary. dragType is * figured in mousePressed */ public void mouseDragged(MouseEvent e) { if (!MouseButtonEvent.isLeftMouseClick(e)) return; // dragFeature set in mousePressed // not needed if (dragging == false && dragFeature != null) { // changer = baseEditorPanel.getAnnotationEditor().beginRangeChange(dragFeature);// ?? preDragStartBasePair = dragFeature.getStart(); preDragEndBasePair = dragFeature.getEnd(); } dragging = true; // dragType determined in MousePressed if (dragType == baseEditorPanel.START_BOUNDARY) baseEditorPanel.setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); else if (dragType == baseEditorPanel.END_BOUNDARY) baseEditorPanel.setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR)); else if (dragType == baseEditorPanel.SEQ_SELECT_DRAG) { baseEditorPanel.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); } setPos(e.getX(), e.getY()); startPos = pos; // going right // substract the one because during dragging // the person operating the mouse drags it // one position beyond where they want the // drop to occur. // pos--; if (dragType == baseEditorPanel.START_BOUNDARY) { // Is this position okay to use as the new // low end or will it make the feature too short? if (baseEditorPanel.notTooSmall( pos, baseEditorPanel.basePairToPos((int) dragFeature.getEnd()))) // this actually changes the model - do we really need to do that // with every mouse drag - cant we just change it at the end of the // drag? No - the EDE relies on the feature being changed - bummer baseEditorPanel.changeStart(dragFeature, pos - dragStartPos, limit_5prime, limit_3prime); } else if (dragType == baseEditorPanel.END_BOUNDARY) { // Is this position okay to use as the new // high end or will it make the feature too short? if (baseEditorPanel.notTooSmall( baseEditorPanel.basePairToPos((int) dragFeature.getStart()), pos)) // This changes the actual exon model! EDE relies on this baseEditorPanel.changeEnd(dragFeature, pos - dragStartPos, limit_5prime, limit_3prime); } else if (dragType == baseEditorPanel.SEQ_SELECT_DRAG) { int redrawLowPos = baseEditorPanel.selectLowPos(); int redrawHighPos = baseEditorPanel.selectHighPos(); if (pos < redrawLowPos) redrawLowPos = pos; if (pos > redrawHighPos) redrawHighPos = pos; // selectCurrentPos = pos; baseEditorPanel.setSelectCurrentPos(pos); baseEditorPanel.repaint(redrawLowPos, redrawHighPos); return; } // repaint with exon seq feature ends changed baseEditorPanel.repaint(pos, dragStartPos); dragStartPos = pos; }