Example #1
0
 private Rectangle getAbsoluteBounds(BoundableRenderable br) {
   int x = 0;
   int y = 0;
   Renderable parent = br;
   while (parent instanceof BoundableRenderable) {
     BoundableRenderable current = (BoundableRenderable) parent;
     Rectangle bounds = current.getBounds();
     x += bounds.x;
     y += bounds.y;
     parent = current.getParent();
   }
   Rectangle oldBounds = br.getBounds();
   return new Rectangle(x, y, oldBounds.width, oldBounds.height);
 }
Example #2
0
 private void onMouseClick(MouseEvent event) {
   Point point = event.getPoint();
   BoundableRenderable r = this.rblock.getRenderable(point);
   if (r != null) {
     Rectangle bounds = r.getBounds();
     r.onMouseClick(event, point.x - bounds.x, point.y - bounds.y);
   }
 }
Example #3
0
 private void onMouseReleased(MouseEvent event) {
   Point point = event.getPoint();
   BoundableRenderable r = this.rblock.getRenderable(point);
   if (r != null) {
     Rectangle bounds = r.getBounds();
     r.onMouseReleased(event, point.x - bounds.x, point.y - bounds.y);
   }
   BoundableRenderable oldTarget = this.mousePressTarget;
   if (oldTarget != null) {
     this.mousePressTarget = null;
     if (oldTarget != r) {
       oldTarget.onMouseDisarmed(event);
     }
   }
 }
Example #4
0
 private void onMousePressed(MouseEvent event) {
   this.requestFocus();
   Point point = event.getPoint();
   BoundableRenderable r = this.rblock.getRenderable(point);
   if (r != null) {
     this.mousePressTarget = r;
     Rectangle bounds = r.getBounds();
     int rx = point.x - bounds.x;
     int ry = point.y - bounds.y;
     r.onMousePressed(event, rx, ry);
     RenderablePoint rp = r.getRenderablePoint(rx, ry);
     if (rp != null) {
       this.frameContext.resetSelection(rp);
     } else {
       this.frameContext.resetSelection(null);
     }
   } else {
     this.frameContext.resetSelection(null);
   }
 }