Example #1
0
  @Override
  public void handleInput(Matrix parentTransform, IInput input) {
    super.handleInput(parentTransform, input);

    Vec2 pointerPos = input.getPointerPos(parentTransform);

    boolean enabled = isEnabled() && isVisible(alphaEnableThreshold);
    boolean mouseContains = enabled && contains(pointerPos.x, pointerPos.y);

    if (enabled) {
      model.setRollover(mouseContains);
      if (mouseContains && input.consumePress(VKey.MOUSE_LEFT)) {
        model.setPressed(true);
      }
      if (!input.isPressed(VKey.MOUSE_LEFT, true)) {
        model.setPressed(false);
      }
    } else {
      model.setRollover(false);
      model.setPressed(false);
    }

    if (clickHandler != null && model.consumePress()) {
      eventDispatcher.addEvent(clickHandler);
    }
  }
Example #2
0
 @Override
 public boolean consumePress() {
   return model.consumePress();
 }