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
Java2Script/SwingJS 3.2.4.05
[jalview.git]
/
src
/
jalview
/
gui
/
ScalePanel.java
diff --git
a/src/jalview/gui/ScalePanel.java
b/src/jalview/gui/ScalePanel.java
index
f772a1f
..
8771119
100755
(executable)
--- a/
src/jalview/gui/ScalePanel.java
+++ b/
src/jalview/gui/ScalePanel.java
@@
-35,6
+35,7
@@
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
+import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@
-266,29
+267,26
@@
public class ScalePanel extends JPanel
}
/**
}
/**
- * DOCUMENT ME!
+ * Action on mouseUp is to set the limit of the current selection group (if
+ * there is one) and broadcast the selection
*
* @param evt
*
* @param evt
- * DOCUMENT ME!
*/
@Override
public void mouseReleased(MouseEvent evt)
{
mouseDragging = false;
*/
@Override
public void mouseReleased(MouseEvent evt)
{
mouseDragging = false;
+ ap.getSeqPanel().stopScrolling();
+ // todo res calculation should be a method on AlignViewport
int res = (evt.getX() / av.getCharWidth())
+ av.getRanges().getStartRes();
int res = (evt.getX() / av.getCharWidth())
+ av.getRanges().getStartRes();
-
if (av.hasHiddenColumns())
{
res = av.getAlignment().getHiddenColumns()
.visibleToAbsoluteColumn(res);
}
if (av.hasHiddenColumns())
{
res = av.getAlignment().getHiddenColumns()
.visibleToAbsoluteColumn(res);
}
-
- if (res >= av.getAlignment().getWidth())
- {
- res = av.getAlignment().getWidth() - 1;
- }
+ res = Math.min(res, av.getAlignment().getWidth() - 1);
if (!stretchingGroup)
{
if (!stretchingGroup)
{
@@
-356,16
+354,23
@@
public class ScalePanel extends JPanel
{
if (mouseDragging)
{
{
if (mouseDragging)
{
- ap.getSeqPanel().scrollCanvas(null);
+ mouseDragging = false;
+ ap.getSeqPanel().stopScrolling();
}
}
}
}
+ /**
+ * Action on leaving the panel bounds with mouse drag in progress is to start
+ * scrolling the alignment in the direction of the mouse. To restrict
+ * scrolling to left-right (not up-down), the y-value of the mouse position is
+ * replaced with zero.
+ */
@Override
public void mouseExited(MouseEvent evt)
{
if (mouseDragging)
{
@Override
public void mouseExited(MouseEvent evt)
{
if (mouseDragging)
{
- ap.getSeqPanel().scrollCanvas(evt);
+ ap.getSeqPanel().startScrolling(new Point(evt.getX(), 0));
}
}
}
}
@@
-410,6
+415,8
@@
public class ScalePanel extends JPanel
@Override
public void paintComponent(Graphics g)
{
@Override
public void paintComponent(Graphics g)
{
+ super.paintComponent(g);
+
/*
* shouldn't get called in wrapped mode as the scale above is
* drawn instead by SeqCanvas.drawNorthScale
/*
* shouldn't get called in wrapped mode as the scale above is
* drawn instead by SeqCanvas.drawNorthScale
@@
-550,7
+557,11
@@
public class ScalePanel extends JPanel
|| evt.getPropertyName().equals(ViewportRanges.MOVE_VIEWPORT))
{
// scroll event, repaint panel
|| evt.getPropertyName().equals(ViewportRanges.MOVE_VIEWPORT))
{
// scroll event, repaint panel
- repaint();
+
+ // Call repaint on alignment panel so that repaints from other alignment
+ // panel components can be aggregated. Otherwise performance of the overview
+ // window and others may be adversely affected.
+ av.getAlignPanel().repaint();
}
}
}
}