private void checkMovementForAllButtons(float x, float y) {
   for (VirtualControllerElement element : virtualController.getElements()) {
     if (element != this && element instanceof DigitalButton) {
       ((DigitalButton) element).checkMovement(x, y, this);
     }
   }
 }
  public boolean checkMovement(float x, float y, DigitalButton movingButton) {
    // check if the movement happened in the same layer
    if (movingButton.layer != this.layer) {
      return false;
    }

    // save current pressed state
    boolean wasPressed = isPressed();

    // check if the movement directly happened on the button
    if ((this.movingButton == null || movingButton == this.movingButton) && this.inRange(x, y)) {
      // set button pressed state depending on moving button pressed state
      if (this.isPressed() != movingButton.isPressed()) {
        this.setPressed(movingButton.isPressed());
      }
    }
    // check if the movement is outside of the range and the movement button
    // is the saved moving button
    else if (movingButton == this.movingButton) {
      this.setPressed(false);
    }

    // check if a change occurred
    if (wasPressed != isPressed()) {
      if (isPressed()) {
        // is pressed set moving button and emit click event
        this.movingButton = movingButton;
        onClickCallback();
      } else {
        // no longer pressed reset moving button and emit release event
        this.movingButton = null;
        onReleaseCallback();
      }

      invalidate();

      return true;
    }

    return false;
  }