From 620da661f54acba8fdb13f388dbed8b77d9113ed Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 2 Oct 2018 08:52:50 +0100 Subject: [PATCH] JAL-3093 added MousePos.isOverAnnotation() for extra clarity of intention --- src/jalview/gui/IdPanel.java | 10 +++++----- src/jalview/gui/SeqPanel.java | 15 ++++++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index 94eab76..54aeef2 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -105,7 +105,7 @@ public class IdPanel extends JPanel { SeqPanel sp = alignPanel.getSeqPanel(); MousePos pos = sp.findMousePosition(e); - if (pos.annotationIndex != -1) + if (pos.isOverAnnotation()) { /* * mouse is over an annotation label in wrapped mode @@ -141,7 +141,7 @@ public class IdPanel extends JPanel mouseDragging = true; MousePos pos = alignPanel.getSeqPanel().findMousePosition(e); - if (pos.annotationIndex != -1) + if (pos.isOverAnnotation()) { // mouse is over annotation label in wrapped mode return; @@ -219,7 +219,7 @@ public class IdPanel extends JPanel } MousePos pos = alignPanel.getSeqPanel().findMousePosition(e); - if (pos.annotationIndex != -1) + if (pos.isOverAnnotation()) { // mouse is over annotation label in wrapped mode return; @@ -306,7 +306,7 @@ public class IdPanel extends JPanel } MousePos pos = alignPanel.getSeqPanel().findMousePosition(e); - if (pos.annotationIndex != -1) + if (pos.isOverAnnotation()) { // mouse is over an annotation label in wrapped mode return; @@ -442,7 +442,7 @@ public class IdPanel extends JPanel scrollThread.running = false; } MousePos pos = alignPanel.getSeqPanel().findMousePosition(e); - if (pos.annotationIndex != -1) + if (pos.isOverAnnotation()) { // mouse is over an annotation label in wrapped mode return; diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index e678738..3f740a1 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -113,6 +113,11 @@ public class SeqPanel extends JPanel annotationIndex = ann; } + boolean isOverAnnotation() + { + return annotationIndex != -1; + } + @Override public boolean equals(Object obj) { @@ -889,7 +894,7 @@ public class SeqPanel extends JPanel } lastMousePosition = mousePos; - if (mousePos.annotationIndex != -1) + if (mousePos.isOverAnnotation()) { mouseMovedOverAnnotation(mousePos); return; @@ -1178,7 +1183,7 @@ public class SeqPanel extends JPanel public void mouseDragged(MouseEvent evt) { MousePos pos = findMousePosition(evt); - if (pos.annotationIndex != -1) + if (pos.isOverAnnotation()) { // mouse is over annotation row in wrapped mode return; @@ -1770,7 +1775,7 @@ public class SeqPanel extends JPanel { SequenceGroup sg = null; MousePos pos = findMousePosition(evt); - if (pos.annotationIndex != -1) + if (pos.isOverAnnotation()) { // mouse is over annotation label in wrapped mode return; @@ -1863,7 +1868,7 @@ public class SeqPanel extends JPanel */ protected void doMousePressedDefineMode(MouseEvent evt, MousePos pos) { - if (pos.annotationIndex != -1) + if (pos.isOverAnnotation()) { // JvOptionPane.showInternalMessageDialog(Desktop.desktop, // MessageManager.getString( @@ -2058,7 +2063,7 @@ public class SeqPanel extends JPanel public void doMouseDraggedDefineMode(MouseEvent evt) { MousePos pos = findMousePosition(evt); - if (pos.annotationIndex != -1) + if (pos.isOverAnnotation()) { // mouse is over annotation in wrapped mode return; -- 1.7.10.2