mirror of
https://github.com/gwm17/implot.git
synced 2024-11-22 18:28:53 -05:00
Sorry!
This commit is contained in:
parent
8879c99aef
commit
626e391670
24
implot.cpp
24
implot.cpp
|
@ -4635,32 +4635,32 @@ ImPlotInputMap& GetInputMap() {
|
||||||
void MapInputDefault(ImPlotInputMap* dst) {
|
void MapInputDefault(ImPlotInputMap* dst) {
|
||||||
ImPlotInputMap& map = dst ? *dst : GetInputMap();
|
ImPlotInputMap& map = dst ? *dst : GetInputMap();
|
||||||
map.Pan = ImGuiMouseButton_Left;
|
map.Pan = ImGuiMouseButton_Left;
|
||||||
map.PanMod = ImGuiModFlags_None;
|
map.PanMod = ImGuiMod_None;
|
||||||
map.Fit = ImGuiMouseButton_Left;
|
map.Fit = ImGuiMouseButton_Left;
|
||||||
map.Menu = ImGuiMouseButton_Right;
|
map.Menu = ImGuiMouseButton_Right;
|
||||||
map.Select = ImGuiMouseButton_Right;
|
map.Select = ImGuiMouseButton_Right;
|
||||||
map.SelectMod = ImGuiModFlags_None;
|
map.SelectMod = ImGuiMod_None;
|
||||||
map.SelectCancel = ImGuiMouseButton_Left;
|
map.SelectCancel = ImGuiMouseButton_Left;
|
||||||
map.SelectHorzMod = ImGuiModFlags_Alt;
|
map.SelectHorzMod = ImGuiMod_Alt;
|
||||||
map.SelectVertMod = ImGuiModFlags_Shift;
|
map.SelectVertMod = ImGuiMod_Shift;
|
||||||
map.OverrideMod = ImGuiModFlags_Ctrl;
|
map.OverrideMod = ImGuiMod_Ctrl;
|
||||||
map.ZoomMod = ImGuiModFlags_None;
|
map.ZoomMod = ImGuiMod_None;
|
||||||
map.ZoomRate = 0.1f;
|
map.ZoomRate = 0.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapInputReverse(ImPlotInputMap* dst) {
|
void MapInputReverse(ImPlotInputMap* dst) {
|
||||||
ImPlotInputMap& map = dst ? *dst : GetInputMap();
|
ImPlotInputMap& map = dst ? *dst : GetInputMap();
|
||||||
map.Pan = ImGuiMouseButton_Right;
|
map.Pan = ImGuiMouseButton_Right;
|
||||||
map.PanMod = ImGuiModFlags_None;
|
map.PanMod = ImGuiMod_None;
|
||||||
map.Fit = ImGuiMouseButton_Left;
|
map.Fit = ImGuiMouseButton_Left;
|
||||||
map.Menu = ImGuiMouseButton_Right;
|
map.Menu = ImGuiMouseButton_Right;
|
||||||
map.Select = ImGuiMouseButton_Left;
|
map.Select = ImGuiMouseButton_Left;
|
||||||
map.SelectMod = ImGuiModFlags_None;
|
map.SelectMod = ImGuiMod_None;
|
||||||
map.SelectCancel = ImGuiMouseButton_Right;
|
map.SelectCancel = ImGuiMouseButton_Right;
|
||||||
map.SelectHorzMod = ImGuiModFlags_Alt;
|
map.SelectHorzMod = ImGuiMod_Alt;
|
||||||
map.SelectVertMod = ImGuiModFlags_Shift;
|
map.SelectVertMod = ImGuiMod_Shift;
|
||||||
map.OverrideMod = ImGuiModFlags_Ctrl;
|
map.OverrideMod = ImGuiMod_Ctrl;
|
||||||
map.ZoomMod = ImGuiModFlags_None;
|
map.ZoomMod = ImGuiMod_None;
|
||||||
map.ZoomRate = 0.1f;
|
map.ZoomRate = 0.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
32
implot.h
32
implot.h
|
@ -543,28 +543,34 @@ struct ImPlotStyle {
|
||||||
IMPLOT_API ImPlotStyle();
|
IMPLOT_API ImPlotStyle();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Support for legacy versions
|
||||||
#if (IMGUI_VERSION_NUM < 18716) // Renamed in 1.88
|
#if (IMGUI_VERSION_NUM < 18716) // Renamed in 1.88
|
||||||
#define ImGuiModFlags ImGuiKeyModFlags
|
#define ImGuiMod_None 0
|
||||||
#define ImGuiModFlags_None ImGuiKeyModFlags_None
|
#define ImGuiMod_Ctrl ImGuiKeyModFlags_Ctrl
|
||||||
#define ImGuiModFlags_Ctrl ImGuiKeyModFlags_Ctrl
|
#define ImGuiMod_Shift ImGuiKeyModFlags_Shift
|
||||||
#define ImGuiModFlags_Shift ImGuiKeyModFlags_Shift
|
#define ImGuiMod_Alt ImGuiKeyModFlags_Alt
|
||||||
#define ImGuiModFlags_Alt ImGuiKeyModFlags_Alt
|
#define ImGuiMod_Super ImGuiKeyModFlags_Super
|
||||||
#define ImGuiModFlags_Super ImGuiKeyModFlags_Super
|
#elif (IMGUI_VERSION_NUM < 18823) // Renamed in 1.89, sorry
|
||||||
|
#define ImGuiMod_None 0
|
||||||
|
#define ImGuiMod_Ctrl ImGuiModFlags_Ctrl
|
||||||
|
#define ImGuiMod_Shift ImGuiModFlags_Shift
|
||||||
|
#define ImGuiMod_Alt ImGuiModFlags_Alt
|
||||||
|
#define ImGuiMod_Super ImGuiModFlags_Super
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Input mapping structure. Default values listed. See also MapInputDefault, MapInputReverse.
|
// Input mapping structure. Default values listed. See also MapInputDefault, MapInputReverse.
|
||||||
struct ImPlotInputMap {
|
struct ImPlotInputMap {
|
||||||
ImGuiMouseButton Pan; // LMB enables panning when held,
|
ImGuiMouseButton Pan; // LMB enables panning when held,
|
||||||
ImGuiModFlags PanMod; // none optional modifier that must be held for panning/fitting
|
int PanMod; // none optional modifier that must be held for panning/fitting
|
||||||
ImGuiMouseButton Fit; // LMB initiates fit when double clicked
|
ImGuiMouseButton Fit; // LMB initiates fit when double clicked
|
||||||
ImGuiMouseButton Select; // RMB begins box selection when pressed and confirms selection when released
|
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
|
ImGuiMouseButton SelectCancel; // LMB cancels active box selection when pressed; cannot be same as Select
|
||||||
ImGuiModFlags SelectMod; // none optional modifier that must be held for box selection
|
int SelectMod; // none optional modifier that must be held for box selection
|
||||||
ImGuiModFlags SelectHorzMod; // Alt expands active box selection horizontally to plot edge when held
|
int 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
|
int SelectVertMod; // Shift expands active box selection vertically to plot edge when held
|
||||||
ImGuiMouseButton Menu; // RMB opens context menus (if enabled) when clicked
|
ImGuiMouseButton Menu; // RMB opens context menus (if enabled) when clicked
|
||||||
ImGuiModFlags OverrideMod; // Ctrl when held, all input is ignored; used to enable axis/plots as DND sources
|
int 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
|
int 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
|
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();
|
IMPLOT_API ImPlotInputMap();
|
||||||
};
|
};
|
||||||
|
@ -1023,7 +1029,7 @@ IMPLOT_API bool BeginDragDropTargetLegend();
|
||||||
IMPLOT_API void EndDragDropTarget();
|
IMPLOT_API void EndDragDropTarget();
|
||||||
|
|
||||||
// NB: By default, plot and axes drag and drop *sources* require holding the Ctrl modifier to initiate the drag.
|
// 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 ImGuiModFlags_None is provided, the axes will be locked from panning.
|
// You can change the modifier if desired. If ImGuiMod_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!
|
// 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);
|
IMPLOT_API bool BeginDragDropSourcePlot(ImGuiDragDropFlags flags=0);
|
||||||
|
|
|
@ -221,16 +221,16 @@ void ButtonSelector(const char* label, ImGuiMouseButton* b) {
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModSelector(const char* label, ImGuiModFlags* k) {
|
void ModSelector(const char* label, int* k) {
|
||||||
ImGui::PushID(label);
|
ImGui::PushID(label);
|
||||||
ImGui::CheckboxFlags("Ctrl", (unsigned int*)k, ImGuiModFlags_Ctrl); ImGui::SameLine();
|
ImGui::CheckboxFlags("Ctrl", (unsigned int*)k, ImGuiMod_Ctrl); ImGui::SameLine();
|
||||||
ImGui::CheckboxFlags("Shift", (unsigned int*)k, ImGuiModFlags_Shift); ImGui::SameLine();
|
ImGui::CheckboxFlags("Shift", (unsigned int*)k, ImGuiMod_Shift); ImGui::SameLine();
|
||||||
ImGui::CheckboxFlags("Alt", (unsigned int*)k, ImGuiModFlags_Alt); ImGui::SameLine();
|
ImGui::CheckboxFlags("Alt", (unsigned int*)k, ImGuiMod_Alt); ImGui::SameLine();
|
||||||
ImGui::CheckboxFlags("Super", (unsigned int*)k, ImGuiModFlags_Super);
|
ImGui::CheckboxFlags("Super", (unsigned int*)k, ImGuiMod_Super);
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputMapping(const char* label, ImGuiMouseButton* b, ImGuiModFlags* k) {
|
void InputMapping(const char* label, ImGuiMouseButton* b, int* k) {
|
||||||
ImGui::LabelText("##","%s",label);
|
ImGui::LabelText("##","%s",label);
|
||||||
if (b != NULL) {
|
if (b != NULL) {
|
||||||
ImGui::SameLine(100);
|
ImGui::SameLine(100);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user