From: gmungoc Date: Thu, 29 Jun 2017 11:20:15 +0000 (+0100) Subject: JAL-2605 exclude left/right scale in sequence column calculation X-Git-Tag: Release_2_10_3b1~132^2~65 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=acbd5f3bbe716bb686872b8fee5431c33dd29d08;p=jalview.git JAL-2605 exclude left/right scale in sequence column calculation --- diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index a72bbaa..5bebe28 100644 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -630,7 +630,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, int y = evt.getY(); y -= hgap; - x -= seqCanvas.LABEL_WEST; + x = Math.max(0, x - seqCanvas.LABEL_WEST); int cwidth = seqCanvas.getWrappedCanvasWidth(getSize().width); if (cwidth < 1) @@ -641,8 +641,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, wrappedBlock = y / cHeight; wrappedBlock += av.getRanges().getStartRes() / cwidth; - res = wrappedBlock * cwidth + x / av.getCharWidth(); - + res = wrappedBlock * cwidth + + Math.min(cwidth - 1, x / av.getCharWidth()); } else { diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 7651eb4..917925b 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -203,7 +203,7 @@ public class SeqPanel extends JPanel implements MouseListener, int y = evt.getY(); y -= hgap; - x -= seqCanvas.LABEL_WEST; + x = Math.max(0, x - seqCanvas.LABEL_WEST); int cwidth = seqCanvas.getWrappedCanvasWidth(this.getWidth()); if (cwidth < 1) @@ -214,8 +214,8 @@ public class SeqPanel extends JPanel implements MouseListener, wrappedBlock = y / cHeight; wrappedBlock += av.getRanges().getStartRes() / cwidth; - res = wrappedBlock * cwidth + x / av.getCharWidth(); - + res = wrappedBlock * cwidth + + Math.min(cwidth - 1, x / av.getCharWidth()); } else {