Update animation trigger

This commit is contained in:
Loic Guegan 2023-01-01 14:46:04 +01:00
parent 0cb695a22b
commit 0c64a5f956

View file

@ -84,20 +84,22 @@ void GameTabLeftPanel::Notify(bool animate, bool backward) {
backward=false;
if (m != nullptr) {
captures = m->GetLineCaptures();
std::string absolute_move= m->GetAbsoluteMove();
// Check if we should animate
if(m->GetParent()==last_move){
wxLogDebug("Animate animate next");
std::string absolute_move= m->GetAbsoluteMove();
animate=true;
src=absolute_move.substr(0,2);
dst=absolute_move.substr(2,2);
} else if (m->GetMainline()==last_move){
wxLogDebug("Animate Previous");
std::string absolute_move= last_move->GetAbsoluteMove();
animate=true;
backward=true;
src=absolute_move.substr(2,2);
dst=absolute_move.substr(0,2);
} else {
std::string absolute_move= last_move->GetAbsoluteMove();
wxLogDebug("Animate Previous");
for(auto v: m->GetVariations()){
if(v==last_move){
@ -108,6 +110,15 @@ void GameTabLeftPanel::Notify(bool animate, bool backward) {
}
}
}
}else if(last_move!=nullptr) {
if(last_move->GetParent()==nullptr){
wxLogDebug("Animate Previous");
std::string absolute_move= last_move->GetAbsoluteMove();
animate=true;
backward=true;
src=absolute_move.substr(2,2);
dst=absolute_move.substr(0,2);
}
}
// Update board canvas: