示例#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);
    }
  }
示例#2
0
 @Override
 public boolean isToggle() {
   return model.isToggle();
 }
示例#3
0
 @Override
 public void setToggle(boolean t) {
   model.setToggle(t);
 }
示例#4
0
 @Override
 public boolean isSelected() {
   return model.isSelected();
 }
示例#5
0
 @Override
 public void setSelected(boolean s) {
   model.setSelected(s);
 }
示例#6
0
 @Override
 public void setEnabled(boolean e) {
   model.setEnabled(e);
 }
示例#7
0
 @Override
 public boolean isEnabled() {
   return model.isEnabled();
 }
示例#8
0
 @Override
 public boolean isPressed() {
   return model.isPressed();
 }
示例#9
0
 @Override
 public boolean isRollover() {
   return model.isRollover();
 }
示例#10
0
 @Override
 public boolean consumePress() {
   return model.consumePress();
 }