1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-11-13 14:38:51 -05:00

Fix ID collisions in the demo (#157)

Several `CollapsingHeader()` use same label as `BeginPlot()`. This creates an ID collision, which confuses Dear ImGui testing engine. Added `##` in `CollapsingHeader()` label are included in ID calculation, but discarded when rendering. This gives affected `CollapsingHeader()` a different ID and solves ID collision.
This commit is contained in:
Rokas Kupstys 2020-12-08 15:31:18 +02:00 committed by GitHub
parent b22c21f912
commit fa10618df6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -286,7 +286,7 @@ void ShowDemoWindow(bool* p_open) {
}
}
//-------------------------------------------------------------------------
if (ImGui::CollapsingHeader("Shaded Plots")) {
if (ImGui::CollapsingHeader("Shaded Plots##")) {
static float xs[1001], ys[1001], ys1[1001], ys2[1001], ys3[1001], ys4[1001];
srand(0);
for (int i = 0; i < 1001; ++i) {
@ -419,7 +419,7 @@ void ShowDemoWindow(bool* p_open) {
ImPlot::EndPlot();
}
}
if (ImGui::CollapsingHeader("Stem Plots")) {
if (ImGui::CollapsingHeader("Stem Plots##")) {
static double xs[51], ys1[51], ys2[51];
for (int i = 0; i < 51; ++i) {
xs[i] = i * 0.02;
@ -1239,7 +1239,7 @@ void ShowDemoWindow(bool* p_open) {
}
}
//-------------------------------------------------------------------------
if (ImGui::CollapsingHeader("Custom Ticks")) {
if (ImGui::CollapsingHeader("Custom Ticks##")) {
static bool custom_ticks = true;
static bool custom_labels = true;
ImGui::Checkbox("Show Custom Ticks", &custom_ticks);
@ -1705,4 +1705,4 @@ void ShowBenchmarkTool() {
}
}
}
}