Skip to content

Commit

Permalink
Fix MessageBoardUI scroll bug and Game logic menhir tile occupant pla…
Browse files Browse the repository at this point in the history
…cing
  • Loading branch information
Mw3y committed May 7, 2024
1 parent 281a7f3 commit 94f2558
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/ch/epfl/chacun/gui/BoardUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ public static Node create(int reach, ObservableValue<GameState> gameStateO,
}

container.setContent(gridPane);
// Center board
container.setVvalue(.5);
container.setHvalue(.5);
return container;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ch/epfl/chacun/gui/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void start(Stage primaryStage) throws Exception {
gameStateO.set(stateAction.gameState());
tileToPlaceRotationP.set(Rotation.NONE);

if (!gameStateO.get().lastTilePotentialOccupants().isEmpty()) {
if (gameStateO.get().nextAction() == GameState.Action.OCCUPY_TILE) {
// Display potential occupants
Set<Occupant> occupantsToDisplay = new HashSet<>(visibleOccupantsP.get());
occupantsToDisplay.addAll(gameStateO.get().lastTilePotentialOccupants());
Expand Down
5 changes: 4 additions & 1 deletion src/ch/epfl/chacun/gui/MessageBoardUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ public static Node create(ObservableValue<List<MessageBoard.Message>> messagesO,
wrapper.getChildren().add(message);
});
// Scroll to the last message
Platform.runLater(() -> container.setVvalue(1));
Platform.runLater(() -> {
container.setVvalue(1);
container.layout();
});
});

wrapper.setSpacing(MESSAGES_SPACING);
Expand Down

0 comments on commit 94f2558

Please sign in to comment.