Skip to content

Commit

Permalink
Minor GUI bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitali-Matteo committed Jun 26, 2024
1 parent 1e380cc commit 4d1421b
Showing 1 changed file with 25 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ private void initialize(){
throw new RuntimeException(e);
}

((Region) chat.getChildren().getFirst()).setPrefHeight(super.getStage().getHeight() -
(this.availableColorsPane.getHeight() + this.privateGoalCardSelectionPane.getHeight() + this.privateGoalCardSelectionPane.getHeight()));
/*((Region) chat.getChildren().getFirst()).setPrefHeight(super.getStage().getHeight() -
(this.availableColorsPane.getHeight() + this.privateGoalCardSelectionPane.getHeight() + this.privateGoalCardSelectionPane.getHeight()));*/

//((Region) chat.getChildren().getFirst()).setPrefHeight(Double.MAX_VALUE);

resizeChat();

try{
FXMLLoader loader = new FXMLLoader();
Expand Down Expand Up @@ -138,6 +142,8 @@ private void initialize(){
}

setBackgrounds();

resizeChat();
}

/**
Expand Down Expand Up @@ -212,6 +218,9 @@ private void buildInitialCardHBox(){
});
}
}
else{
rightVBox.getChildren().remove(initialCardOrientationPane);
}
}

/**
Expand All @@ -238,6 +247,9 @@ private void buildPrivateGoalCardSelectionHBox(){

this.goalCardsHBox.getChildren().addAll(cardButtons);
}
else{
rightVBox.getChildren().remove(privateGoalCardSelectionPane);
}
}

/**
Expand All @@ -250,12 +262,10 @@ private void buildAvailableColorsPane(){
this.hbox.getChildren().clear();
hbox.getChildren().addAll(colorButtonFactory(this.getLocalModel().getAvailableColors()));
}

if(getLocalModel().getPersonalStation().getChosenColor() != null){
ArrayList<Button> button = colorButtonFactory(List.of(this.getLocalModel().getPersonalStation().getChosenColor()));

this.hbox.getChildren().clear();
this.hbox.getChildren().add(button.getFirst());
else{
if(getLocalModel().getPersonalStation() != null && getLocalModel().getPersonalStation().getChosenColor() != null) {
rightVBox.getChildren().remove(availableColorsPane);
}
}
}

Expand Down Expand Up @@ -328,7 +338,13 @@ private Button buildColorButton(Color c, Circle circlePawn) {
* Resizes {@link #chat} to fill empty space on {@link #rightVBox}.
*/
private void resizeChat(){
((Region) chat.getChildren().getFirst()).setPrefHeight(((ScrollPane) chat.getChildren().getFirst()).getHeight() + 0.25 * ((Region) chat.getParent()).getHeight());
//((Region) chat.getChildren().getFirst()).setPrefHeight(((ScrollPane) chat.getChildren().getFirst()).getHeight() + 0.25 * ((Region) chat.getParent()).getHeight());

((Region) chat.getChildren().getFirst()).setPrefHeight(super.getStage().getHeight() -
this.rightVBox.getChildren().stream()
.filter(f -> !f.equals(chat))
.mapToDouble(f -> ((Region) f).getHeight())
.sum());
}

/**
Expand Down

0 comments on commit 4d1421b

Please sign in to comment.