fix: highlight destroyed on dimension reshape

This commit is contained in:
2026-08-24 19:17:30 +02:00
parent 94028a05fd
commit 0ceaf21ad6
2 changed files with 5 additions and 3 deletions

View File

@@ -142,7 +142,7 @@ impl Board {
false
}
pub fn update_state(&mut self) {
pub fn update_dimensions(&mut self) {
self.fields.clear();
let field_size = self.rect.w / self.board_view.size as f32;
@@ -172,6 +172,8 @@ impl Board {
color: if is_field_black { BLACK } else { WHITE },
});
}
self.highlight_current_moves(); // we rehighlithg as changing dimensions will destroy this
}
pub fn draw(&self) {

View File

@@ -252,7 +252,7 @@ impl GameClient {
ServerMessage::BroadcastBoardState { board } => {
self.board.update_board_view(board);
self.board.update_state();
self.board.update_dimensions();
}
ServerMessage::BroadcastCurrentTurn { active_player } => {
@@ -313,7 +313,7 @@ impl GameClient {
};
if self.board.update_board_rect(self.board_area) {
self.board.update_state();
self.board.update_dimensions();
}
}
}