From 23dc9ea34d4c4b6da586e23291f1a489b323b19b Mon Sep 17 00:00:00 2001 From: hansonr Date: Tue, 2 Jul 2019 20:27:13 +0200 Subject: [PATCH] JAL-3345 JAL3253 Smoother ScalePanel-based scrolling --- src/jalview/gui/ScalePanel.java | 6 ++++++ src/jalview/gui/SeqPanel.java | 31 +++++++++++++------------------ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index a6b4b49..bfa903a 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -585,4 +585,10 @@ public class ScalePanel extends JPanel } } + public boolean isMouseDragging() + { + // TODO Auto-generated method stub + return mouseDragging; + } + } diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 2df55ad..26ec081 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -134,7 +134,6 @@ public class SeqPanel extends JPanel MousePos o = (MousePos) obj; boolean b = (column == o.column && seqIndex == o.seqIndex && annotationIndex == o.annotationIndex); - // System.out.println(obj + (b ? "= " : "!= ") + this); return b; } @@ -1504,7 +1503,6 @@ public class SeqPanel extends JPanel return; } - // System.out.print(y1+" "+y2+" "+fixedLeft+" "+fixedRight+"~~"); // Selection spans a hidden region if (fixedLeft < y1 && (fixedRight > y2 || fixedRight == -1)) { @@ -1942,13 +1940,17 @@ public class SeqPanel extends JPanel @Override public void mouseExited(MouseEvent e) { + if (ap.getScalePanel().isMouseDragging()) + { + ap.getScalePanel().mouseExited(e); + return; + } lastMousePosition = null; ap.alignFrame.setStatus(" "); if (av.getWrapAlignment()) { return; } - if (mouseDragging && scrollThread == null) { startScrolling(e.getPoint()); @@ -2424,29 +2426,22 @@ public class SeqPanel extends JPanel // if (!scrollOnce() {t.stop();}) gives compiler error :-( scrollThread.scrollOnce(); } - } - }); - t.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { if (scrollThread == null) { // SeqPanel.stopScrolling called - t.stop(); + ((Timer) e.getSource()).stop(); } } }); t.start(); } - } - else - { - /* - * Java - run in a new thread - */ - scrollThread.start(); + else + { + /* + * Java - run in a new thread + */ + scrollThread.start(); + } } } -- 1.7.10.2