From 67139edaa71fcbba9536f90e041355cb33abe96b Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 11 Apr 2007 13:01:18 +0000 Subject: [PATCH] Use same mouse events as scalePanel --- src/jalview/gui/AnnotationPanel.java | 104 +++++----------------------------- 1 file changed, 14 insertions(+), 90 deletions(-) diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index ecc1d29..86fef5f 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -200,6 +200,9 @@ public class AnnotationPanel { int index = av.getColumnSelection().columnAt(i); + if(!av.colSel.isVisible(index)) + continue; + if (anot[index] == null) { anot[index] = new Annotation(label, "", ' ', 0); @@ -218,6 +221,9 @@ public class AnnotationPanel { int index = av.getColumnSelection().columnAt(i); + if(!av.colSel.isVisible(index)) + continue; + if (anot[index] == null) { anot[index] = new Annotation("", "", ' ', 0); @@ -264,6 +270,9 @@ public class AnnotationPanel { int index = av.getColumnSelection().columnAt(i); + if(!av.colSel.isVisible(index)) + continue; + if (anot[index] == null) { anot[index] = new Annotation(label, "", type, 0); @@ -354,36 +363,7 @@ public class AnnotationPanel return; } - int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); - - if (av.hasHiddenColumns) - { - res = av.getColumnSelection().adjustForHiddenColumns(res); - } - - min = res; - max = res; - - if (av.getColumnSelection().contains(res)) - { - av.getColumnSelection().removeElement(res); - } - else - { - av.getColumnSelection().addElement(res); - SequenceGroup sg = new SequenceGroup(); - - for (int i = 0; i < av.alignment.getSequences().size(); i++) - { - sg.addSequence(av.alignment.getSequenceAt(i), false); - } - - sg.setStartRes(res); - sg.setEndRes(res); - av.setSelectionGroup(sg); - } - - ap.paintAlignment(true); + ap.scalePanel.mousePressed(evt); } @@ -397,6 +377,7 @@ public class AnnotationPanel graphStretch = -1; graphStretchY = -1; mouseDragging = false; + ap.scalePanel.mouseReleased(evt); } /** @@ -406,10 +387,7 @@ public class AnnotationPanel */ public void mouseEntered(MouseEvent evt) { - if (mouseDragging) - { - ap.seqPanel.scrollCanvas(null); - } + ap.scalePanel.mouseEntered(evt); } /** @@ -419,10 +397,7 @@ public class AnnotationPanel */ public void mouseExited(MouseEvent evt) { - if (mouseDragging) - { - ap.seqPanel.scrollCanvas(evt); - } + ap.scalePanel.mouseExited(evt); } /** @@ -446,58 +421,7 @@ public class AnnotationPanel } else { - mouseDragging = true; - - int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); - - if (av.hasHiddenColumns) - { - res = av.getColumnSelection().adjustForHiddenColumns(res); - } - - SequenceGroup sg = av.getSelectionGroup(); - - if (res < min) - { - min = res; - } - - if (res > max) - { - max = res; - } - - if (sg != null) - { - if (!av.getColumnSelection().contains(res)) - { - av.getColumnSelection().addElement(res); - } - - if (res > sg.getStartRes()) - { - sg.setEndRes(res); - } - else if (res < sg.getStartRes()) - { - sg.setStartRes(res); - } - - for (int i = min; i <= max; i++) - { - if ( (i < sg.getStartRes()) || (i > sg.getEndRes())) - { - av.getColumnSelection().removeElement(i); - } - else - { - av.getColumnSelection().addElement(i); - } - } - - ap.paintAlignment(true); - } - + ap.scalePanel.mouseDragged(evt); } } -- 1.7.10.2