예제 #1
0
  @Override
  public void setVisible(boolean visible0) {
    if (isVisible() == visible0) {
      return;
    }

    // add/remove drop down from current screen or top overlay when its visibility changes
    FContainer container = FOverlay.getTopOverlay();
    if (container == null) {
      container = Forge.getCurrentScreen();
    }
    if (visible0) {
      updateSizeAndPosition();

      if (autoHide()) { // add invisible backdrop if needed to allow auto-hiding when pressing
                        // outide drop down
        backdrop = new Backdrop();
        backdrop.setSize(container.getWidth(), container.getHeight());
        container.add(backdrop);
      }
      container.add(this);
    } else {
      container.remove(this);
      if (backdrop != null) {
        backdrop.setVisible(false);
        container.remove(backdrop);
        backdrop = null;
      }
    }
    super.setVisible(visible0);
  }
예제 #2
0
  protected void updateSizeAndPosition() {
    if (!getRotate90()) {
      super.updateSizeAndPosition();
      return;
    }

    FMenuTab menuTab = getMenuTab();
    float screenHeight = Forge.getScreenHeight();
    float width = (screenHeight - 2 * VPrompt.HEIGHT - 2 * VAvatar.HEIGHT) * 4f / 6f;
    float maxVisibleHeight = menuTab.screenPos.x;
    paneSize =
        updateAndGetPaneSize(
            width
                + MatchController.getView()
                    .getTopPlayerPanel()
                    .getTabs()
                    .iterator()
                    .next()
                    .getRight(),
            maxVisibleHeight);

    // round width and height so borders appear properly
    paneSize = new ScrollBounds(Math.round(paneSize.getWidth()), Math.round(paneSize.getHeight()));

    setBounds(
        Math.round(menuTab.screenPos.x - width),
        Math.round((screenHeight + width) / 2),
        paneSize.getWidth(),
        Math.min(paneSize.getHeight(), maxVisibleHeight));
  }
예제 #3
0
 public void update() {
   if (isVisible()) {
     updateSizeAndPosition();
   }
 }