From 4f2c68de6013bab307b299cfd6158225475a3fc6 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Mon, 2 Jan 2023 08:15:51 +0100 Subject: Update CGEditor+debug --- src/game_tab/left_panel/GameTabLeftPanel.cpp | 2 +- src/game_tab/right_panel/editor/EditorCanvas.cpp | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/game_tab/left_panel/GameTabLeftPanel.cpp b/src/game_tab/left_panel/GameTabLeftPanel.cpp index fd89791..fa97f6f 100644 --- a/src/game_tab/left_panel/GameTabLeftPanel.cpp +++ b/src/game_tab/left_panel/GameTabLeftPanel.cpp @@ -63,12 +63,12 @@ GameTabLeftPanel::GameTabLeftPanel(wxFrame *parent, std::shared_ptr game) void GameTabLeftPanel::OnPlay(wxCommandEvent &event) { wxLogDebug("Game tab received PLAY_MOVE_EVENT"); if (game->Play(event.GetString().ToStdString())) { - Notify(true); // Notify other classes wxCommandEvent event(GAME_CHANGE, GetId()); event.SetEventObject(this); ProcessEvent(event); } + Notify(true); // Redraw event is move failed! Otherwise piece not resets to it initial position after dragging } void GameTabLeftPanel::Notify(bool skip_animation) { diff --git a/src/game_tab/right_panel/editor/EditorCanvas.cpp b/src/game_tab/right_panel/editor/EditorCanvas.cpp index 5a0afd0..19d81ec 100644 --- a/src/game_tab/right_panel/editor/EditorCanvas.cpp +++ b/src/game_tab/right_panel/editor/EditorCanvas.cpp @@ -216,13 +216,7 @@ void EditorCanvas::MouseEvent(wxMouseEvent &event) { // Handle editor events Update(); - bool need_redraw=false; - for(auto event: status.Events){ - HandleEvent(event); - need_redraw=true; - } - if(need_redraw){ - status.Events.clear(); + if(ProcessEvents()){ Refresh(); Update(); } -- cgit v1.2.3