git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-2842 remove infinite loop in cursor move
[jalview.git]
/
src
/
jalview
/
gui
/
SeqPanel.java
diff --git
a/src/jalview/gui/SeqPanel.java
b/src/jalview/gui/SeqPanel.java
index
e99e577
..
dbbf510
100644
(file)
--- a/
src/jalview/gui/SeqPanel.java
+++ b/
src/jalview/gui/SeqPanel.java
@@
-215,8
+215,8
@@
public class SeqPanel extends JPanel
+ hgap + seqCanvas.getAnnotationHeight();
int y = evt.getY();
+ hgap + seqCanvas.getAnnotationHeight();
int y = evt.getY();
- y -= hgap;
- x = Math.max(0, x - seqCanvas.labelWidthWest);
+ y = Math.max(0, y - hgap);
+ x = Math.max(0, x - seqCanvas.getLabelWidthWest());
int cwidth = seqCanvas.getWrappedCanvasWidth(this.getWidth());
if (cwidth < 1)
int cwidth = seqCanvas.getWrappedCanvasWidth(this.getWidth());
if (cwidth < 1)
@@
-363,8
+363,11
@@
public class SeqPanel extends JPanel
int original = seqCanvas.cursorX - dx;
int maxWidth = av.getAlignment().getWidth();
int original = seqCanvas.cursorX - dx;
int maxWidth = av.getAlignment().getWidth();
+ // TODO: once JAL-2759 is ready, change this loop to something more
+ // efficient
while (!hidden.isVisible(seqCanvas.cursorX)
while (!hidden.isVisible(seqCanvas.cursorX)
- && seqCanvas.cursorX < maxWidth && seqCanvas.cursorX > 0)
+ && seqCanvas.cursorX < maxWidth && seqCanvas.cursorX > 0
+ && dx != 0)
{
seqCanvas.cursorX += dx;
}
{
seqCanvas.cursorX += dx;
}
@@
-484,7
+487,7
@@
public class SeqPanel extends JPanel
av.setSelectionGroup(sg);
}
av.setSelectionGroup(sg);
}
- ap.paintAlignment(false);
+ ap.paintAlignment(false, false);
av.sendSelection();
}
av.sendSelection();
}
@@
-719,10
+722,12
@@
public class SeqPanel extends JPanel
}
/**
}
/**
- * DOCUMENT ME!
+ * Action on mouse movement is to update the status bar to show the current
+ * sequence position, and (if features are shown) to show any features at the
+ * position in a tooltip. Does nothing if the mouse move does not change
+ * residue position.
*
* @param evt
*
* @param evt
- * DOCUMENT ME!
*/
@Override
public void mouseMoved(MouseEvent evt)
*/
@Override
public void mouseMoved(MouseEvent evt)
@@
-735,7
+740,8
@@
public class SeqPanel extends JPanel
}
final int column = findColumn(evt);
}
final int column = findColumn(evt);
- int seq = findSeq(evt);
+ final int seq = findSeq(evt);
+
if (column < 0 || seq < 0 || seq >= av.getAlignment().getHeight())
{
lastMouseSeq = -1;
if (column < 0 || seq < 0 || seq >= av.getAlignment().getHeight())
{
lastMouseSeq = -1;
@@
-852,11
+858,12
@@
public class SeqPanel extends JPanel
/**
* set when the current UI interaction has resulted in a change that requires
/**
* set when the current UI interaction has resulted in a change that requires
- * overview shading to be recalculated. this could be changed to something
- * more expressive that indicates what actually has changed, so selective
- * redraws can be applied
+ * shading in overviews and structures to be recalculated. this could be
+ * changed to a something more expressive that indicates what actually has
+ * changed, so selective redraws can be applied (ie. only structures, only
+ * overview, etc)
*/
*/
- private boolean needOverviewUpdate = false; // TODO: refactor to avcontroller
+ private boolean updateOverviewAndStructs = false; // TODO: refactor to avcontroller
/**
* set if av.getSelectionGroup() refers to a group that is defined on the
/**
* set if av.getSelectionGroup() refers to a group that is defined on the
@@
-1057,7
+1064,7
@@
public class SeqPanel extends JPanel
}
if (newWidth > 0)
{
}
if (newWidth > 0)
{
- ap.paintAlignment(false);
+ ap.paintAlignment(false, false);
if (copyChanges)
{
/*
if (copyChanges)
{
/*
@@
-1626,7
+1633,7
@@
public class SeqPanel extends JPanel
av.getRanges().scrollRight(true);
}
av.getRanges().scrollRight(true);
}
- else if (!av.getWrapAlignment())
+ else
{
av.getRanges().scrollUp(false);
}
{
av.getRanges().scrollUp(false);
}
@@
-1637,12
+1644,18
@@
public class SeqPanel extends JPanel
{
av.getRanges().scrollRight(false);
}
{
av.getRanges().scrollRight(false);
}
- else if (!av.getWrapAlignment())
+ else
{
av.getRanges().scrollUp(true);
}
}
{
av.getRanges().scrollUp(true);
}
}
- // TODO Update tooltip for new position.
+
+ /*
+ * update status bar and tooltip for new position
+ * (need to synthesize a mouse movement to refresh tooltip)
+ */
+ mouseMoved(e);
+ ToolTipManager.sharedInstance().mouseMoved(e);
}
/**
}
/**
@@
-1656,7
+1669,7
@@
public class SeqPanel extends JPanel
final int res = findColumn(evt);
final int seq = findSeq(evt);
oldSeq = seq;
final int res = findColumn(evt);
final int seq = findSeq(evt);
oldSeq = seq;
- needOverviewUpdate = false;
+ updateOverviewAndStructs = false;
startWrapBlock = wrappedBlock;
startWrapBlock = wrappedBlock;
@@
-1821,7
+1834,7
@@
public class SeqPanel extends JPanel
// always do this - annotation has own state
// but defer colourscheme update until hidden sequences are passed in
boolean vischange = stretchGroup.recalcConservation(true);
// always do this - annotation has own state
// but defer colourscheme update until hidden sequences are passed in
boolean vischange = stretchGroup.recalcConservation(true);
- needOverviewUpdate |= vischange && av.isSelectionDefinedGroup()
+ updateOverviewAndStructs |= vischange && av.isSelectionDefinedGroup()
&& afterDrag;
if (stretchGroup.cs != null)
{
&& afterDrag;
if (stretchGroup.cs != null)
{
@@
-1841,8
+1854,10
@@
public class SeqPanel extends JPanel
}
}
PaintRefresher.Refresh(this, av.getSequenceSetId());
}
}
PaintRefresher.Refresh(this, av.getSequenceSetId());
- ap.paintAlignment(needOverviewUpdate);
- needOverviewUpdate = false;
+ // TODO: structure colours only need updating if stretchGroup used to or now
+ // does contain sequences with structure views
+ ap.paintAlignment(updateOverviewAndStructs, updateOverviewAndStructs);
+ updateOverviewAndStructs = false;
changeEndRes = false;
changeStartRes = false;
stretchGroup = null;
changeEndRes = false;
changeStartRes = false;
stretchGroup = null;
@@
-1896,7
+1911,7
@@
public class SeqPanel extends JPanel
if (res > (stretchGroup.getStartRes() - 1))
{
stretchGroup.setEndRes(res);
if (res > (stretchGroup.getStartRes() - 1))
{
stretchGroup.setEndRes(res);
- needOverviewUpdate |= av.isSelectionDefinedGroup();
+ updateOverviewAndStructs |= av.isSelectionDefinedGroup();
}
}
else if (changeStartRes)
}
}
else if (changeStartRes)
@@
-1904,7
+1919,7
@@
public class SeqPanel extends JPanel
if (res < (stretchGroup.getEndRes() + 1))
{
stretchGroup.setStartRes(res);
if (res < (stretchGroup.getEndRes() + 1))
{
stretchGroup.setStartRes(res);
- needOverviewUpdate |= av.isSelectionDefinedGroup();
+ updateOverviewAndStructs |= av.isSelectionDefinedGroup();
}
}
}
}
@@
-1938,7
+1953,7
@@
public class SeqPanel extends JPanel
if (stretchGroup.getSequences(null).contains(nextSeq))
{
stretchGroup.deleteSequence(seq, false);
if (stretchGroup.getSequences(null).contains(nextSeq))
{
stretchGroup.deleteSequence(seq, false);
- needOverviewUpdate |= av.isSelectionDefinedGroup();
+ updateOverviewAndStructs |= av.isSelectionDefinedGroup();
}
else
{
}
else
{
@@
-1948,7
+1963,7
@@
public class SeqPanel extends JPanel
}
stretchGroup.addSequence(nextSeq, false);
}
stretchGroup.addSequence(nextSeq, false);
- needOverviewUpdate |= av.isSelectionDefinedGroup();
+ updateOverviewAndStructs |= av.isSelectionDefinedGroup();
}
}
}
}