[implot] Update to 0.15 (#32650)

This commit is contained in:
Rémy Tassoux 2023-07-20 04:58:09 +02:00 committed by GitHub
parent 5e9cbd9ac2
commit a6657c38d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 75 deletions

View File

@ -1,68 +0,0 @@
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"
//-----------------------------------------------------------------------------
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;

View File

@ -4,10 +4,8 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO epezent/implot
REF v${VERSION}
SHA512 d33c83762ada55d4e188e975faf0c12d42cb3eb6b63904e6bce5b18d4184a2cdfc14e0b92286717ab86a1361dad7161e24402724f4eda2c0bce5658787d2dbe3
SHA512 75d5f7e429aaf6eaa3a7eaedf5bcb54ac78fd04121baa8d0fff76bf9a87a52bd27f59bc07df7f81807619f75f570e1f5be70f35a34376f7e7b1f0bf0722b899a
HEAD_REF master
PATCHES
fix-build.patch
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")

View File

@ -1,7 +1,6 @@
{
"name": "implot",
"version": "0.14",
"port-version": 2,
"version": "0.15",
"description": "Advanced 2D Plotting for Dear ImGui",
"homepage": "https://github.com/epezent/implot",
"license": "MIT",

View File

@ -3365,8 +3365,8 @@
"port-version": 1
},
"implot": {
"baseline": "0.14",
"port-version": 2
"baseline": "0.15",
"port-version": 0
},
"indicators": {
"baseline": "2.3",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "67023cbc6fc4301549ef49fa263c70995d693cf5",
"version": "0.15",
"port-version": 0
},
{
"git-tree": "3ecadd10832f0628f406b27e5470c3d35db6824c",
"version": "0.14",