[iagno] Clear highlight on undo.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] Clear highlight on undo.
- Date: Sat, 16 Feb 2019 14:40:53 +0000 (UTC)
commit 8c8fd388bd88cec525581b7abd78962664e5bfe5
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sat Feb 16 12:58:20 2019 +0100
Clear highlight on undo.
If the keyboard highlight was
activated, undoing was making
multiple tiles highlighted. A
little cleaning feels better.
src/game-view.vala | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/game-view.vala b/src/game-view.vala
index ea797f2..a9006bc 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -404,6 +404,19 @@ private class GameView : Gtk.DrawingArea
{
if (replacement == Player.NONE)
{
+ // clear the previous highlight (if any)
+ if (show_highlight)
+ {
+ highlight_state = 0;
+ set_square (highlight_x,
+ highlight_y,
+ get_pixmap (game.get_owner (x, y)),
+ /* force redraw */ true);
+ // no highliqht animation after undo
+ highlight_state = HIGHLIGHT_MAX;
+ }
+
+ // set highlight on undone play position
highlight_set = true;
highlight_x = x;
highlight_y = y;
@@ -421,9 +434,9 @@ private class GameView : Gtk.DrawingArea
set_square (x, y, get_pixmap (game.get_owner (x, y)));
}
- private void set_square (uint8 x, uint8 y, int pixmap)
+ private void set_square (uint8 x, uint8 y, int pixmap, bool force_redraw = false)
{
- if (pixmaps [x, y] == pixmap)
+ if (!force_redraw && pixmaps [x, y] == pixmap)
return;
if (pixmap == 0 || pixmaps [x, y] == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]