예제 #1
0
  /** was this object clicked at? (mouse pointer location (x,y) in screen coords) */
  @Override
  public boolean hit(int x, int y, int hitThreshold) {
    boolean res = false;
    if (isDrawingOnCanvas()) {
      int left = xLabel;
      int top = boxTop;
      int right = left + labelSize.x + boxWidth;
      int bottom = top + boxHeight;
      //
      res =
          (x > left && x < right && y > top && y < bottom)
              || (x > xLabel && x < xLabel + labelSize.x && y > yLabel && y < yLabel + labelSize.y);

    } else {
      res = box.getBounds().contains(x, y);
    }
    return res;
  }
예제 #2
0
 @Override
 public boolean intersectsRectangle(GRectangle rect) {
   return box.getBounds().intersects(rect);
 }