From acbd5f3bbe716bb686872b8fee5431c33dd29d08 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 29 Jun 2017 12:20:15 +0100 Subject: [PATCH] JAL-2605 exclude left/right scale in sequence column calculation --- src/jalview/appletgui/SeqPanel.java | 6 +++--- src/jalview/gui/SeqPanel.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) 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 { -- 1.7.10.2