mirror of
https://github.com/gwm17/implot.git
synced 2024-11-13 22:48:50 -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:
parent
b22c21f912
commit
fa10618df6
|
@ -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];
|
static float xs[1001], ys[1001], ys1[1001], ys2[1001], ys3[1001], ys4[1001];
|
||||||
srand(0);
|
srand(0);
|
||||||
for (int i = 0; i < 1001; ++i) {
|
for (int i = 0; i < 1001; ++i) {
|
||||||
|
@ -419,7 +419,7 @@ void ShowDemoWindow(bool* p_open) {
|
||||||
ImPlot::EndPlot();
|
ImPlot::EndPlot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ImGui::CollapsingHeader("Stem Plots")) {
|
if (ImGui::CollapsingHeader("Stem Plots##")) {
|
||||||
static double xs[51], ys1[51], ys2[51];
|
static double xs[51], ys1[51], ys2[51];
|
||||||
for (int i = 0; i < 51; ++i) {
|
for (int i = 0; i < 51; ++i) {
|
||||||
xs[i] = i * 0.02;
|
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_ticks = true;
|
||||||
static bool custom_labels = true;
|
static bool custom_labels = true;
|
||||||
ImGui::Checkbox("Show Custom Ticks", &custom_ticks);
|
ImGui::Checkbox("Show Custom Ticks", &custom_ticks);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user