X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2FOverviewDimensions.java;h=f053a95cf4ebdb3e0a6090a753d41db640b120a9;hb=18b0c645cdfafae15e9f1d8c5a38bfa4ef45dc3c;hp=dd7eb1e19e201a4444838acc6a3beb0b064bc88b;hpb=c2e5d3d1ebe3b283bdde15637c590721cd6c5637;p=jalview.git diff --git a/src/jalview/viewmodel/OverviewDimensions.java b/src/jalview/viewmodel/OverviewDimensions.java index dd7eb1e..f053a95 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,24 @@ 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); + } + + /** + * Answers if a mouse position is in the overview's red box + * + * @param x + * mouse x position + * @param y + * mouse y position + * @return true if (x,y) is inside the box + */ + protected boolean isPositionInBox(int x, int y) + { + return (x > boxX && y > boxY && boxX + x < boxWidth + && boxY + y < boxHeight); } } \ No newline at end of file