From d7ab9290294941178265fbd3da9c71ac9f969f05 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 24 Aug 2016 14:07:26 +0100 Subject: [PATCH] JAL-2151 port fix to applet --- src/jalview/appletgui/ScalePanel.java | 39 ++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/jalview/appletgui/ScalePanel.java b/src/jalview/appletgui/ScalePanel.java index 0f71818..d2c1693 100755 --- a/src/jalview/appletgui/ScalePanel.java +++ b/src/jalview/appletgui/ScalePanel.java @@ -409,22 +409,33 @@ public class ScalePanel extends Panel implements MouseMotionListener, // Fill the selected columns ColumnSelection cs = av.getColumnSelection(); - gg.setColor(new Color(220, 0, 0)); int avCharWidth = av.getCharWidth(); int avcharHeight = av.getCharHeight(); - for (int sel : cs.getSelected()) + if (cs != null) { - // TODO: JAL-2001 - provide a fast method to list visible selected in a - // given range - if (av.hasHiddenColumns()) + gg.setColor(new Color(220, 0, 0)); + boolean hasHiddenColumns = cs.hasHiddenColumns(); + for (int sel : cs.getSelected()) { - sel = av.getColumnSelection().findColumnPosition(sel); - } + // TODO: JAL-2001 - provide a fast method to list visible selected in a + // given range + if (hasHiddenColumns) + { + if (cs.isVisible(sel)) + { + sel = cs.findColumnPosition(sel); + } + else + { + continue; + } + } - if ((sel >= startx) && (sel <= endx)) - { - gg.fillRect((sel - startx) * avCharWidth, 0, avCharWidth, - getSize().height); + if ((sel >= startx) && (sel <= endx)) + { + gg.fillRect((sel - startx) * avCharWidth, 0, avCharWidth, + getSize().height); + } } } @@ -471,12 +482,10 @@ public class ScalePanel extends Panel implements MouseMotionListener, if (av.getShowHiddenMarkers()) { int widthx = 1 + endx - startx; - for (int i = 0; i < av.getColumnSelection().getHiddenColumns() - .size(); i++) + for (int i = 0; i < cs.getHiddenColumns().size(); i++) { - res = av.getColumnSelection().findHiddenRegionPosition(i) - - startx; + res = cs.findHiddenRegionPosition(i) - startx; if (res < 0 || res > widthx) { -- 1.7.10.2