diff --git a/implot.cpp b/implot.cpp index 37476279..9a3ba890 100644 --- a/implot.cpp +++ b/implot.cpp @@ -4498,32 +4498,32 @@ ImPlotInputMap& GetInputMap() { void MapInputDefault(ImPlotInputMap* dst) { ImPlotInputMap& map = dst ? *dst : GetInputMap(); map.Pan = ImGuiMouseButton_Left; - map.PanMod = ImGuiKeyModFlags_None; + map.PanMod = ImGuiModFlags_None; map.Fit = ImGuiMouseButton_Left; map.Menu = ImGuiMouseButton_Right; map.Select = ImGuiMouseButton_Right; - map.SelectMod = ImGuiKeyModFlags_None; + map.SelectMod = ImGuiModFlags_None; map.SelectCancel = ImGuiMouseButton_Left; - map.SelectHorzMod = ImGuiKeyModFlags_Alt; - map.SelectVertMod = ImGuiKeyModFlags_Shift; - map.OverrideMod = ImGuiKeyModFlags_Ctrl; - map.ZoomMod = ImGuiKeyModFlags_None; + map.SelectHorzMod = ImGuiModFlags_Alt; + map.SelectVertMod = ImGuiModFlags_Shift; + map.OverrideMod = ImGuiModFlags_Ctrl; + map.ZoomMod = ImGuiModFlags_None; map.ZoomRate = 0.1f; } void MapInputReverse(ImPlotInputMap* dst) { ImPlotInputMap& map = dst ? *dst : GetInputMap(); map.Pan = ImGuiMouseButton_Right; - map.PanMod = ImGuiKeyModFlags_None; + map.PanMod = ImGuiModFlags_None; map.Fit = ImGuiMouseButton_Left; map.Menu = ImGuiMouseButton_Right; map.Select = ImGuiMouseButton_Left; - map.SelectMod = ImGuiKeyModFlags_None; + map.SelectMod = ImGuiModFlags_None; map.SelectCancel = ImGuiMouseButton_Right; - map.SelectHorzMod = ImGuiKeyModFlags_Alt; - map.SelectVertMod = ImGuiKeyModFlags_Shift; - map.OverrideMod = ImGuiKeyModFlags_Ctrl; - map.ZoomMod = ImGuiKeyModFlags_None; + map.SelectHorzMod = ImGuiModFlags_Alt; + map.SelectVertMod = ImGuiModFlags_Shift; + map.OverrideMod = ImGuiModFlags_Ctrl; + map.ZoomMod = ImGuiModFlags_None; map.ZoomRate = 0.1f; } diff --git a/implot.h b/implot.h index 8226eda3..07f13af1 100644 --- a/implot.h +++ b/implot.h @@ -405,19 +405,28 @@ struct ImPlotStyle { IMPLOT_API ImPlotStyle(); }; +#if (IMGUI_VERSION_NUM < 18716) // Renamed in 1.88 +#define ImGuiModFlags ImGuiKeyModFlags +#define ImGuiModFlags_None ImGuiKeyModFlags_None +#define ImGuiModFlags_Ctrl ImGuiKeyModFlags_Ctrl +#define ImGuiModFlags_Shift ImGuiKeyModFlags_Shift +#define ImGuiModFlags_Alt ImGuiKeyModFlags_Alt +#define ImGuiModFlags_Super ImGuiKeyModFlags_Super +#endif + // Input mapping structure. Default values listed. See also MapInputDefault, MapInputReverse. struct ImPlotInputMap { ImGuiMouseButton Pan; // LMB enables panning when held, - ImGuiKeyModFlags PanMod; // none optional modifier that must be held for panning/fitting + ImGuiModFlags PanMod; // none optional modifier that must be held for panning/fitting ImGuiMouseButton Fit; // LMB initiates fit when double clicked ImGuiMouseButton Select; // RMB begins box selection when pressed and confirms selection when released ImGuiMouseButton SelectCancel; // LMB cancels active box selection when pressed; cannot be same as Select - ImGuiKeyModFlags SelectMod; // none optional modifier that must be held for box selection - ImGuiKeyModFlags SelectHorzMod; // Alt expands active box selection horizontally to plot edge when held - ImGuiKeyModFlags SelectVertMod; // Shift expands active box selection vertically to plot edge when held + ImGuiModFlags SelectMod; // none optional modifier that must be held for box selection + ImGuiModFlags SelectHorzMod; // Alt expands active box selection horizontally to plot edge when held + ImGuiModFlags SelectVertMod; // Shift expands active box selection vertically to plot edge when held ImGuiMouseButton Menu; // RMB opens context menus (if enabled) when clicked - ImGuiKeyModFlags OverrideMod; // Ctrl when held, all input is ignored; used to enable axis/plots as DND sources - ImGuiKeyModFlags ZoomMod; // none optional modifier that must be held for scroll wheel zooming + ImGuiModFlags OverrideMod; // Ctrl when held, all input is ignored; used to enable axis/plots as DND sources + ImGuiModFlags ZoomMod; // none optional modifier that must be held for scroll wheel zooming float ZoomRate; // 0.1f zoom rate for scroll (e.g. 0.1f = 10% plot range every scroll click); make negative to invert IMPLOT_API ImPlotInputMap(); }; @@ -880,7 +889,7 @@ IMPLOT_API bool BeginDragDropTargetLegend(); IMPLOT_API void EndDragDropTarget(); // NB: By default, plot and axes drag and drop *sources* require holding the Ctrl modifier to initiate the drag. -// You can change the modifier if desired. If ImGuiKeyModFlags_None is provided, the axes will be locked from panning. +// You can change the modifier if desired. If ImGuiModFlags_None is provided, the axes will be locked from panning. // Turns the current plot's plotting area into a drag and drop source. You must hold Ctrl. Don't forget to call EndDragDropSource! IMPLOT_API bool BeginDragDropSourcePlot(ImGuiDragDropFlags flags = 0); diff --git a/implot_demo.cpp b/implot_demo.cpp index be1548cb..d7465fb2 100644 --- a/implot_demo.cpp +++ b/implot_demo.cpp @@ -226,16 +226,16 @@ void ButtonSelector(const char* label, ImGuiMouseButton* b) { ImGui::PopID(); } -void ModSelector(const char* label, ImGuiKeyModFlags* k) { +void ModSelector(const char* label, ImGuiModFlags* k) { ImGui::PushID(label); - ImGui::CheckboxFlags("Ctrl", (unsigned int*)k, ImGuiKeyModFlags_Ctrl); ImGui::SameLine(); - ImGui::CheckboxFlags("Shift", (unsigned int*)k, ImGuiKeyModFlags_Shift); ImGui::SameLine(); - ImGui::CheckboxFlags("Alt", (unsigned int*)k, ImGuiKeyModFlags_Alt); ImGui::SameLine(); - ImGui::CheckboxFlags("Super", (unsigned int*)k, ImGuiKeyModFlags_Super); + ImGui::CheckboxFlags("Ctrl", (unsigned int*)k, ImGuiModFlags_Ctrl); ImGui::SameLine(); + ImGui::CheckboxFlags("Shift", (unsigned int*)k, ImGuiModFlags_Shift); ImGui::SameLine(); + ImGui::CheckboxFlags("Alt", (unsigned int*)k, ImGuiModFlags_Alt); ImGui::SameLine(); + ImGui::CheckboxFlags("Super", (unsigned int*)k, ImGuiModFlags_Super); ImGui::PopID(); } -void InputMapping(const char* label, ImGuiMouseButton* b, ImGuiKeyModFlags* k) { +void InputMapping(const char* label, ImGuiMouseButton* b, ImGuiModFlags* k) { ImGui::LabelText("##","%s",label); if (b != NULL) { ImGui::SameLine(100);