@Override public boolean hit(IPointerEvent e) { int x = e.getX(); int y = e.getY(); UI ui = getUI(); float bx = ui.getX() + getX() * (BUTTON_GAP + BUTTON_WIDTH); float by = ui.getY() + getY() * (BUTTON_GAP + BUTTON_HEIGHT); return x >= bx && x <= bx + BUTTON_WIDTH && y >= by && y <= by + BUTTON_HEIGHT; }
@Override public boolean pointerPressed(IPointerEvent e) { if (hit(e)) { fire(e.getView()); return true; } return false; }