1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-27 17:10:57 +01:00

PlotHistogram, PlotLines: register item ID in a more idiomatic manner. (#7935, #3072)

This commit is contained in:
ocornut 2024-09-03 21:49:35 +02:00
parent f99febfd6f
commit afb15e9795
3 changed files with 8 additions and 1 deletions

View File

@ -92,6 +92,8 @@ Other changes:
- TextLink(), TextLinkOpenURL(): change mouse cursor to Hand shape when hovered. (#7885, #7660) - TextLink(), TextLinkOpenURL(): change mouse cursor to Hand shape when hovered. (#7885, #7660)
- Tooltips, Drag and Drop: made it possible to override BeginTooltip() position while inside - Tooltips, Drag and Drop: made it possible to override BeginTooltip() position while inside
a drag and drop source or target: a SetNextWindowPos() call won't be overriden. (#6973) a drag and drop source or target: a SetNextWindowPos() call won't be overriden. (#6973)
- PlotHistogram, PlotLines: register item ID in a more idiomatic manner, fixes preventing
e.g. GetItemID() and other ID-based helper to work. (#7935, #3072)
- Style: added PushStyleVarX(), PushStyleVarY() helpers to modify only one component of a ImVec2 var. - Style: added PushStyleVarX(), PushStyleVarY() helpers to modify only one component of a ImVec2 var.
- Fonts: made it possible to use PushFont()/PopFont() calls accross Begin() calls. (#3224, #3875, #6398, #7903) - Fonts: made it possible to use PushFont()/PopFont() calls accross Begin() calls. (#3224, #3875, #6398, #7903)
- Backends: - Backends:

View File

@ -2004,6 +2004,10 @@ static void ShowDemoWindowWidgets(ImGuiDemoWindowData* demo_data)
ImGui::PlotHistogram("Histogram", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0, 80)); ImGui::PlotHistogram("Histogram", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0, 80));
ImGui::Separator(); ImGui::Separator();
ImGui::Text("Need better plotting and graphing? Consider using ImPlot:");
ImGui::TextLinkOpenURL("https://github.com/epezent/implot");
ImGui::Separator();
ImGui::TreePop(); ImGui::TreePop();
} }
@ -6448,6 +6452,7 @@ static void ShowDemoWindowTables()
ImGui::CheckboxFlags("_ScrollX", &table_flags, ImGuiTableFlags_ScrollX); ImGui::CheckboxFlags("_ScrollX", &table_flags, ImGuiTableFlags_ScrollX);
ImGui::CheckboxFlags("_ScrollY", &table_flags, ImGuiTableFlags_ScrollY); ImGui::CheckboxFlags("_ScrollY", &table_flags, ImGuiTableFlags_ScrollY);
ImGui::CheckboxFlags("_Resizable", &table_flags, ImGuiTableFlags_Resizable); ImGui::CheckboxFlags("_Resizable", &table_flags, ImGuiTableFlags_Resizable);
ImGui::CheckboxFlags("_Sortable", &table_flags, ImGuiTableFlags_Sortable);
ImGui::CheckboxFlags("_NoBordersInBody", &table_flags, ImGuiTableFlags_NoBordersInBody); ImGui::CheckboxFlags("_NoBordersInBody", &table_flags, ImGuiTableFlags_NoBordersInBody);
ImGui::CheckboxFlags("_HighlightHoveredColumn", &table_flags, ImGuiTableFlags_HighlightHoveredColumn); ImGui::CheckboxFlags("_HighlightHoveredColumn", &table_flags, ImGuiTableFlags_HighlightHoveredColumn);
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8); ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);

View File

@ -8224,7 +8224,7 @@ int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_get
const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding); const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding);
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0)); const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0));
ItemSize(total_bb, style.FramePadding.y); ItemSize(total_bb, style.FramePadding.y);
if (!ItemAdd(total_bb, 0, &frame_bb)) if (!ItemAdd(total_bb, id, &frame_bb, ImGuiItemFlags_NoNav))
return -1; return -1;
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags); const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags);