1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-10-09 15:47:26 -04:00

Switched from in-class initialization to setting the default input mapping in a constructor in the .cpp file.

This commit is contained in:
Jaap Suter 2020-06-15 09:55:30 -07:00
parent 989815bec5
commit ce79420146
2 changed files with 45 additions and 18 deletions

View File

@ -133,6 +133,30 @@ bool ImPlotLimits::Contains(double x, double y) const {
return X.Contains(x) && Y.Contains(y);
}
ImPlotInputMap::ImPlotInputMap() {
PanButton = ImGuiMouseButton_Left;
PanMod = ImGuiKeyModFlags_None;
BoxSelectButton = ImGuiMouseButton_Right;
BoxSelectMod = ImGuiKeyModFlags_None;
BoxCancelButton = ImGuiMouseButton_Left;
QueryClickButton = ImGuiMouseButton_Left;
QueryClickMod = ImGuiKeyModFlags_Ctrl;
QueryDragButton = ImGuiMouseButton_Middle;
QueryDragMod = ImGuiKeyModFlags_None;
QueryDragButton2 = ImGuiMouseButton_Right;
QueryDragMod2 = ImGuiKeyModFlags_Ctrl;
HorizontalSizeMod = ImGuiKeyModFlags_Alt;
VerticalSizeMod = ImGuiKeyModFlags_Shift;
}
namespace ImPlot {
namespace {

View File

@ -172,27 +172,30 @@ struct ImPlotStyle {
ImPlotStyle();
};
// Input mapping structure, and their default values.
// Input mapping structure, default values listed in the comments.
struct ImPlotInputMap {
ImGuiMouseButton PanButton = ImGuiMouseButton_Left;
ImGuiKeyModFlags PanMod = ImGuiKeyModFlags_None;
ImGuiMouseButton BoxSelectButton = ImGuiMouseButton_Right;
ImGuiKeyModFlags BoxSelectMod = ImGuiKeyModFlags_None;
ImPlotInputMap();
ImGuiMouseButton BoxCancelButton = ImGuiMouseButton_Left;
ImGuiMouseButton QueryClickButton = ImGuiMouseButton_Left;
ImGuiKeyModFlags QueryClickMod = ImGuiKeyModFlags_Ctrl;
ImGuiMouseButton QueryDragButton = ImGuiMouseButton_Middle;
ImGuiKeyModFlags QueryDragMod = ImGuiKeyModFlags_None;
ImGuiMouseButton QueryDragButton2 = ImGuiMouseButton_Right;
ImGuiKeyModFlags QueryDragMod2 = ImGuiKeyModFlags_Ctrl;
ImGuiKeyModFlags HorizontalSizeMod = ImGuiKeyModFlags_Alt;
ImGuiKeyModFlags VerticalSizeMod = ImGuiKeyModFlags_Shift;
ImGuiMouseButton PanButton; // left mouse
ImGuiKeyModFlags PanMod; // none
ImGuiMouseButton BoxSelectButton; // right mouse
ImGuiKeyModFlags BoxSelectMod; // none
ImGuiMouseButton BoxCancelButton; // left mouse
ImGuiMouseButton QueryClickButton; // left mouse
ImGuiKeyModFlags QueryClickMod; // ctrl
ImGuiMouseButton QueryDragButton; // middle mouse
ImGuiKeyModFlags QueryDragMod; // none
ImGuiMouseButton QueryDragButton2; // right mouse, alternative way to query drag, useful when middle mouse is not available
ImGuiKeyModFlags QueryDragMod2; // ctrl
ImGuiKeyModFlags HorizontalSizeMod; // alt
ImGuiKeyModFlags VerticalSizeMod; // shift
};
//-----------------------------------------------------------------------------