From e10afba2adb890640e5ee9e3b0c086b981c4009b Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 15 Feb 2017 16:47:34 +0000 Subject: [PATCH] =?utf8?q?JAL-2374=20don=E2=80=99t=20search=20twice=20for=20?= =?utf8?q?containing=20group=20to=20assign=20to=20stretchGroup?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/appletgui/SeqPanel.java | 26 +------------------------- src/jalview/gui/SeqPanel.java | 26 +------------------------- 2 files changed, 2 insertions(+), 50 deletions(-) diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index 8cfd2dc..904e3ce 100644 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -1423,36 +1423,12 @@ public class SeqPanel extends Panel implements MouseMotionListener, stretchGroup = av.getSelectionGroup(); - if (stretchGroup == null) + if (stretchGroup == null || !stretchGroup.contains(sequence, res)) { stretchGroup = av.getAlignment().findGroup(sequence, res); av.setSelectionGroup(stretchGroup); } - if (stretchGroup == null - || !stretchGroup.getSequences(null).contains(sequence) - || stretchGroup.getStartRes() > res - || stretchGroup.getEndRes() < res) - { - stretchGroup = null; - - SequenceGroup[] allGroups = av.getAlignment().findAllGroups(sequence); - - if (allGroups != null) - { - for (int i = 0; i < allGroups.length; i++) - { - if (allGroups[i].getStartRes() <= res - && allGroups[i].getEndRes() >= res) - { - stretchGroup = allGroups[i]; - break; - } - } - } - av.setSelectionGroup(stretchGroup); - } - // DETECT RIGHT MOUSE BUTTON IN AWT if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index e402d28..0046206 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -1587,35 +1587,11 @@ public class SeqPanel extends JPanel implements MouseListener, stretchGroup = av.getSelectionGroup(); - if (stretchGroup == null) + if (stretchGroup == null || !stretchGroup.contains(sequence, res)) { stretchGroup = av.getAlignment().findGroup(sequence, res); av.setSelectionGroup(stretchGroup); } - if (stretchGroup == null - || !stretchGroup.getSequences(null).contains(sequence) - || (stretchGroup.getStartRes() > res) - || (stretchGroup.getEndRes() < res)) - { - stretchGroup = null; - - SequenceGroup[] allGroups = av.getAlignment().findAllGroups(sequence); - - if (allGroups != null) - { - for (int i = 0; i < allGroups.length; i++) - { - if ((allGroups[i].getStartRes() <= res) - && (allGroups[i].getEndRes() >= res)) - { - stretchGroup = allGroups[i]; - break; - } - } - } - - av.setSelectionGroup(stretchGroup); - } if (evt.isPopupTrigger()) // Mac: mousePressed { -- 1.7.10.2