コード例 #1
0
ファイル: CanvasDrawable.java プロジェクト: DanielG/geolibra
  /** 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
ファイル: CanvasDrawable.java プロジェクト: DanielG/geolibra
 @Override
 public boolean intersectsRectangle(GRectangle rect) {
   return box.getBounds().intersects(rect);
 }