@@ -57,10 +57,10 @@ using std::to_string;
57
57
58
58
static int g_dismissed_version = 0 ;
59
59
60
- static bool g_show_modal = false ;
60
+ static bool g_open_help = false ;
61
61
62
62
static const vector<pair<string, string>> g_help_strings = {
63
- {" h" , " Show this help window" },
63
+ {" h" , " Toggle this help window" },
64
64
{" Left click+drag" , " Rotate the camera" },
65
65
{" Scroll mouse/pinch" , " Zoom the camera" },
66
66
{" 1" , " Switch to XY orthographic view" },
@@ -268,7 +268,7 @@ SampleViewer::SampleViewer()
268
268
if (posX > ImGui::GetCursorPosX ())
269
269
ImGui::SetCursorPosX (posX);
270
270
if (ImGui::MenuItem (text))
271
- g_show_modal = true ;
271
+ g_open_help = true ;
272
272
};
273
273
274
274
m_params.callbacks .ShowAppMenuItems = [this ]()
@@ -405,7 +405,7 @@ SampleViewer::SampleViewer()
405
405
auto s = HelloImGui::LoadUserPref (" AboutDismissedVersion" );
406
406
g_dismissed_version = strtol (s.c_str (), nullptr , 10 );
407
407
if (g_dismissed_version < version_combined ())
408
- g_show_modal = true ;
408
+ g_open_help = true ;
409
409
};
410
410
411
411
m_params.callbacks .BeforeExit = []
@@ -514,7 +514,7 @@ void SampleViewer::draw_gui()
514
514
515
515
void SampleViewer::draw_about_dialog ()
516
516
{
517
- if (g_show_modal )
517
+ if (g_open_help )
518
518
ImGui::OpenPopup (" About" );
519
519
520
520
// Always center this window when appearing
@@ -524,7 +524,8 @@ void SampleViewer::draw_about_dialog()
524
524
const float2 col_width = {11 * HelloImGui::EmSize (), 32 * HelloImGui::EmSize ()};
525
525
ImGui::SetNextWindowContentSize (float2{col_width[0 ] + col_width[1 ], 0 });
526
526
527
- if (ImGui::BeginPopupModal (" About" , nullptr ,
527
+ bool about_open = true ;
528
+ if (ImGui::BeginPopupModal (" About" , &about_open,
528
529
ImGuiWindowFlags_HorizontalScrollbar | ImGuiWindowFlags_NoSavedSettings |
529
530
ImGuiWindowFlags_AlwaysAutoResize))
530
531
{
@@ -697,15 +698,15 @@ void SampleViewer::draw_about_dialog()
697
698
// ImGui::SetKeyboardFocusHere();
698
699
if (ImGui::Button (" Dismiss" , ImVec2 (120 , 0 )) || ImGui::IsKeyPressed (ImGuiKey_Escape) ||
699
700
ImGui::IsKeyPressed (ImGuiKey_Enter) || ImGui::IsKeyPressed (ImGuiKey_Space) ||
700
- (!g_show_modal && ImGui::IsKeyPressed (ImGuiKey_H)))
701
+ (!g_open_help && ImGui::IsKeyPressed (ImGuiKey_H)))
701
702
{
702
703
ImGui::CloseCurrentPopup ();
703
704
g_dismissed_version = version_combined ();
704
705
}
705
706
ImGui::SetItemDefaultFocus ();
706
707
707
708
ImGui::EndPopup ();
708
- g_show_modal = false ;
709
+ g_open_help = false ;
709
710
}
710
711
}
711
712
@@ -1174,7 +1175,7 @@ void SampleViewer::process_hotkeys()
1174
1175
else if (ImGui::IsKeyPressed (ImGuiKey_B))
1175
1176
m_show_bbox = !m_show_bbox;
1176
1177
else if (ImGui::IsKeyPressed (ImGuiKey_H))
1177
- g_show_modal = !g_show_modal ;
1178
+ g_open_help = !g_open_help ;
1178
1179
}
1179
1180
1180
1181
void SampleViewer::update_points (bool regenerate)
0 commit comments