aboutsummaryrefslogtreecommitdiff
path: root/src/CGEditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/CGEditor.cpp')
-rw-r--r--src/CGEditor.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/CGEditor.cpp b/src/CGEditor.cpp
index cf405db..1cdb012 100644
--- a/src/CGEditor.cpp
+++ b/src/CGEditor.cpp
@@ -8,6 +8,7 @@ CGEditor::CGEditor() {
MT = new MoveTable(&status);
MA = new Margin(&status);
ME = new Menu(&status);
+ TF=nullptr;
// Default Standard NagTable: https://en.wikipedia.org/wiki/Numeric_Annotation_Glyphs
status.NagTable[0]="";
status.NagTable[1]="!";
@@ -81,6 +82,14 @@ void CGEditor::Draw() {
MA->Refresh();
MT->Refresh();
MA->DrawMargin(MT->GetVariationsMarging());
+ // Check if we need to focus on a specific move:
+ if(TF!=nullptr){
+ double X,Y;
+ MT->GetMoveXY(TF,X,Y);
+ SBH->Focus(X+status.MoveWidth);
+ SBV->Focus(Y+status.MoveHeight);
+ TF=nullptr;
+ }
SBV->Refresh();
SBH->Refresh();
ME->Refresh();
@@ -181,9 +190,6 @@ std::uint8_t CGEditor::GetNAGId(const std::string& symbol) const{
}
void CGEditor::FocusOnMove(CMI::HalfMove* move){
- double X,Y;
- MT->GetMoveXY(move,X,Y);
- SBH->Focus(X+status.MoveWidth);
- SBV->Focus(Y+status.MoveHeight);
+ TF=move;
}
} // namespace cgeditor