From b21b4cdb3d8bbf84d0b86c6d3ea724aa3c1ea3f8 Mon Sep 17 00:00:00 2001 From: kiramt Date: Mon, 15 May 2017 12:27:53 +0100 Subject: [PATCH] JAL-2491 Better merge but not quite right yet --- src/jalview/viewmodel/OverviewDimensions.java | 13 +++++-------- src/jalview/viewmodel/OverviewDimensionsHideHidden.java | 15 ++++----------- src/jalview/viewmodel/OverviewDimensionsShowHidden.java | 14 +++++++------- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/jalview/viewmodel/OverviewDimensions.java b/src/jalview/viewmodel/OverviewDimensions.java index dd7eb1e..d2912d8 100644 --- a/src/jalview/viewmodel/OverviewDimensions.java +++ b/src/jalview/viewmodel/OverviewDimensions.java @@ -225,8 +225,8 @@ public abstract class OverviewDimensions */ protected abstract void resetAlignmentDims(); - protected void setBoxPosition(int startRes, int endRes, int startSeq, - int endSeq) + protected void setBoxPosition(int startRes, int startSeq, int vpwidth, + int vpheight) { resetAlignmentDims(); @@ -235,12 +235,9 @@ public abstract class OverviewDimensions boxY = Math.round((float) startSeq * sequencesHeight / alheight); // boxWidth is the width in residues translated to pixels - // since the box includes both the start and end residues, add 1 to the - // difference - boxWidth = Math - .round((float) (endRes - startRes + 1) * width / alwidth); + boxWidth = Math.round((float) vpwidth * width / alwidth); + // boxHeight is the height in sequences translated to pixels - boxHeight = Math.round((float) (endSeq - startSeq + 1) - * sequencesHeight / alheight); + boxHeight = Math.round((float) vpheight * sequencesHeight / alheight); } } \ No newline at end of file diff --git a/src/jalview/viewmodel/OverviewDimensionsHideHidden.java b/src/jalview/viewmodel/OverviewDimensionsHideHidden.java index 9236151..cb9c535 100644 --- a/src/jalview/viewmodel/OverviewDimensionsHideHidden.java +++ b/src/jalview/viewmodel/OverviewDimensionsHideHidden.java @@ -64,7 +64,7 @@ public class OverviewDimensionsHideHidden extends OverviewDimensions } else { - xAsRes = ranges.getEndRes(); + xAsRes = ranges.getStartRes(); } } @@ -89,7 +89,7 @@ public class OverviewDimensionsHideHidden extends OverviewDimensions } else { - yAsSeq = ranges.getEndSeq(); + yAsSeq = ranges.getStartSeq(); } } @@ -103,15 +103,8 @@ public class OverviewDimensionsHideHidden extends OverviewDimensions public void setBoxPosition(HiddenSequences hiddenSeqs, HiddenColumns hiddenCols) { - // work with visible values of startRes and endRes - int startRes = ranges.getStartRes(); - int endRes = ranges.getEndRes(); - - // work with visible values of startSeq and endSeq - int startSeq = ranges.getStartSeq(); - int endSeq = ranges.getEndSeq(); - - setBoxPosition(startRes, endRes, startSeq, endSeq); + setBoxPosition(ranges.getStartRes(), ranges.getStartSeq(), + ranges.getViewportWidth(), ranges.getViewportHeight()); } @Override diff --git a/src/jalview/viewmodel/OverviewDimensionsShowHidden.java b/src/jalview/viewmodel/OverviewDimensionsShowHidden.java index 4f7d6c2..3506332 100644 --- a/src/jalview/viewmodel/OverviewDimensionsShowHidden.java +++ b/src/jalview/viewmodel/OverviewDimensionsShowHidden.java @@ -115,7 +115,7 @@ public class OverviewDimensionsShowHidden extends OverviewDimensions } else { - visXAsRes = ranges.getEndRes(); + visXAsRes = ranges.getStartRes(); } } @@ -149,13 +149,13 @@ public class OverviewDimensionsShowHidden extends OverviewDimensions } else { - visYAsSeq = ranges.getEndSeq(); + visYAsSeq = ranges.getStartSeq(); } } // update viewport - ranges.setStartRes(xAsRes); - ranges.setStartSeq(yAsSeq); + ranges.setStartRes(visXAsRes); + ranges.setStartSeq(visYAsSeq); } @@ -175,15 +175,15 @@ public class OverviewDimensionsShowHidden extends OverviewDimensions HiddenColumns hiddenCols) { // work with absolute values of startRes and endRes - int startRes = hiddenCols - .adjustForHiddenColumns(ranges.getStartRes()); + int startRes = hiddenCols.adjustForHiddenColumns(ranges.getStartRes()); int endRes = hiddenCols.adjustForHiddenColumns(ranges.getEndRes()); // work with absolute values of startSeq and endSeq int startSeq = hiddenSeqs.adjustForHiddenSeqs(ranges.getStartSeq()); int endSeq = hiddenSeqs.adjustForHiddenSeqs(ranges.getEndSeq()); - setBoxPosition(startRes, endRes, startSeq, endSeq); + setBoxPosition(startRes, startSeq, endRes - startRes + 1, endSeq + - startSeq + 1); } @Override -- 1.7.10.2