mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
Chess: Highlight piece origin square when dragging piece
This commit is contained in:
parent
49deb936be
commit
bab8bd143f
Notes:
sideshowbarker
2024-07-17 18:46:57 +09:00
Author: https://github.com/jean-lourenco 🔰 Commit: https://github.com/SerenityOS/serenity/commit/bab8bd143f Pull-request: https://github.com/SerenityOS/serenity/pull/15031
@ -157,6 +157,14 @@ void ChessWidget::paint_event(GUI::PaintEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
Gfx::IntRect origin_square;
|
||||
if (side() == Chess::Color::White) {
|
||||
origin_square = { m_moving_square.file * tile_width, (7 - m_moving_square.rank) * tile_height, tile_width, tile_height };
|
||||
} else {
|
||||
origin_square = { (7 - m_moving_square.file) * tile_width, m_moving_square.rank * tile_height, tile_width, tile_height };
|
||||
}
|
||||
painter.fill_rect(origin_square, m_move_highlight_color);
|
||||
|
||||
auto bmp = m_pieces.get(active_board.get_piece(m_moving_square));
|
||||
if (bmp.has_value()) {
|
||||
auto center = m_drag_point - Gfx::IntPoint(tile_width / 2, tile_height / 2);
|
||||
|
Loading…
Reference in New Issue
Block a user