mirror of
https://github.com/szymon-jozef/checkers.git
synced 2026-10-27 19:20:44 +01:00
fix: highlight destroyed on dimension reshape
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user