2023-03-22 04:23:47 +08:00
|
|
|
diff --git a/implot.h b/implot.h
|
|
|
|
index 997d96f..fb1ff02 100644
|
|
|
|
--- a/implot.h
|
|
|
|
+++ b/implot.h
|
|
|
|
@@ -45,6 +45,9 @@
|
|
|
|
// [SECTION] Obsolete API
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
+#ifndef IMGUI_DEFINE_MATH_OPERATORS
|
|
|
|
+#define IMGUI_DEFINE_MATH_OPERATORS
|
|
|
|
+#endif
|
|
|
|
#include "imgui.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2023-07-08 00:13:30 +08:00
|
|
|
diff --git a/implot.cpp b/implot.cpp
|
|
|
|
index b76ffb7..22e4261 100644
|
|
|
|
--- a/implot.cpp
|
|
|
|
+++ b/implot.cpp
|
|
|
|
@@ -132,6 +132,11 @@ You can read releases logs https://github.com/epezent/implot/releases for more d
|
|
|
|
#define ImDrawFlags_RoundCornersAll ImDrawCornerFlags_All
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+// Support for pre-1.89.7 versions.
|
|
|
|
+#if (IMGUI_VERSION_NUM < 18966)
|
|
|
|
+#define ImGuiButtonFlags_AllowOverlap ImGuiButtonFlags_AllowItemOverlap
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
// Visual Studio warnings
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
|
|
|
@@ -1802,7 +1807,7 @@ bool UpdateInput(ImPlotPlot& plot) {
|
|
|
|
|
|
|
|
// BUTTON STATE -----------------------------------------------------------
|
|
|
|
|
|
|
|
- const ImGuiButtonFlags plot_button_flags = ImGuiButtonFlags_AllowItemOverlap
|
|
|
|
+ const ImGuiButtonFlags plot_button_flags = ImGuiButtonFlags_AllowOverlap
|
|
|
|
| ImGuiButtonFlags_PressedOnClick
|
|
|
|
| ImGuiButtonFlags_PressedOnDoubleClick
|
|
|
|
| ImGuiButtonFlags_MouseButtonLeft
|
|
|
|
@@ -1812,7 +1817,9 @@ bool UpdateInput(ImPlotPlot& plot) {
|
|
|
|
| plot_button_flags;
|
|
|
|
|
|
|
|
const bool plot_clicked = ImGui::ButtonBehavior(plot.PlotRect,plot.ID,&plot.Hovered,&plot.Held,plot_button_flags);
|
|
|
|
- ImGui::SetItemAllowOverlap();
|
|
|
|
+#if (IMGUI_VERSION_NUM < 18966)
|
|
|
|
+ ImGui::SetItemAllowOverlap(); // Handled by ButtonBehavior()
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
if (plot_clicked) {
|
|
|
|
if (!ImHasFlag(plot.Flags, ImPlotFlags_NoBoxSelect) && IO.MouseClicked[gp.InputMap.Select] && ImHasFlag(IO.KeyMods, gp.InputMap.SelectMod)) {
|
|
|
|
@@ -3378,7 +3385,7 @@ bool BeginSubplots(const char* title, int rows, int cols, const ImVec2& size, Im
|
|
|
|
ImGui::KeepAliveID(sep_id);
|
|
|
|
const ImRect sep_bb = ImRect(subplot.GridRect.Min.x, ypos-SUBPLOT_SPLITTER_HALF_THICKNESS, subplot.GridRect.Max.x, ypos+SUBPLOT_SPLITTER_HALF_THICKNESS);
|
|
|
|
bool sep_hov = false, sep_hld = false;
|
|
|
|
- const bool sep_clk = ImGui::ButtonBehavior(sep_bb, sep_id, &sep_hov, &sep_hld, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick);
|
|
|
|
+ const bool sep_clk = ImGui::ButtonBehavior(sep_bb, sep_id, &sep_hov, &sep_hld, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick);
|
|
|
|
if ((sep_hov && G.HoveredIdTimer > SUBPLOT_SPLITTER_FEEDBACK_TIMER) || sep_hld) {
|
|
|
|
if (sep_clk && ImGui::IsMouseDoubleClicked(0)) {
|
|
|
|
float p = (subplot.RowRatios[r] + subplot.RowRatios[r+1])/2;
|
|
|
|
@@ -3408,7 +3415,7 @@ bool BeginSubplots(const char* title, int rows, int cols, const ImVec2& size, Im
|
|
|
|
ImGui::KeepAliveID(sep_id);
|
|
|
|
const ImRect sep_bb = ImRect(xpos-SUBPLOT_SPLITTER_HALF_THICKNESS, subplot.GridRect.Min.y, xpos+SUBPLOT_SPLITTER_HALF_THICKNESS, subplot.GridRect.Max.y);
|
|
|
|
bool sep_hov = false, sep_hld = false;
|
|
|
|
- const bool sep_clk = ImGui::ButtonBehavior(sep_bb, sep_id, &sep_hov, &sep_hld, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick);
|
|
|
|
+ const bool sep_clk = ImGui::ButtonBehavior(sep_bb, sep_id, &sep_hov, &sep_hld, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick);
|
|
|
|
if ((sep_hov && G.HoveredIdTimer > SUBPLOT_SPLITTER_FEEDBACK_TIMER) || sep_hld) {
|
|
|
|
if (sep_clk && ImGui::IsMouseDoubleClicked(0)) {
|
|
|
|
float p = (subplot.ColRatios[c] + subplot.ColRatios[c+1])/2;
|