JAL-2611 Added overview dimensions test for position in box
[jalview.git] / src / jalview / viewmodel / OverviewDimensions.java
index d2912d8..f053a95 100644 (file)
@@ -240,4 +240,19 @@ public abstract class OverviewDimensions
     // boxHeight is the height in sequences translated to pixels
     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