From d807442afcceb77cbf4858171011405bab7b7946 Mon Sep 17 00:00:00 2001 From: T0NZ Date: Fri, 17 Jul 2026 17:04:07 +0700 Subject: [PATCH] Fix build against ImGui >= 1.92.8 (ImLerp cannot take ImOffsetRect) Added ImLerp overload for ImOffsetRect to support new ImGui version. --- imgui_offset_rect.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/imgui_offset_rect.h b/imgui_offset_rect.h index e01738c..4e7698f 100644 --- a/imgui_offset_rect.h +++ b/imgui_offset_rect.h @@ -39,3 +39,13 @@ static inline ImOffsetRect operator+(const ImOffsetRect& lhs, const ImOffsetRect static inline ImOffsetRect operator-(const ImOffsetRect& lhs, const ImOffsetRect& rhs) { return ImOffsetRect(lhs.Top - rhs.Top, lhs.Left - rhs.Left, lhs.Bottom - rhs.Bottom, lhs.Right - rhs.Right); } static inline ImOffsetRect operator*(const ImOffsetRect& lhs, const ImOffsetRect& rhs) { return ImOffsetRect(lhs.Top * rhs.Top, lhs.Left * rhs.Left, lhs.Bottom * rhs.Bottom, lhs.Right * rhs.Right); } IM_MSVC_RUNTIME_CHECKS_RESTORE + +// ImGui 1.92.8 (19274) changed the generic ImLerp to `(T)((float)a + (float)(b - a) * t)`, which needs a +// T -> float conversion. ImOffsetRect only converts the other way (its float constructor), so the +// template fails to instantiate and imgui_toggle_renderer.cpp's KnobInset/KnobOffset lerps stop +// compiling. An exact-match overload wins over the template and keeps the same component-wise result. +#if IMGUI_VERSION_NUM >= 19274 +IM_MSVC_RUNTIME_CHECKS_OFF +static inline ImOffsetRect ImLerp(ImOffsetRect a, ImOffsetRect b, float t) { return (a + (b - a) * t); } +IM_MSVC_RUNTIME_CHECKS_RESTORE +#endif // IMGUI_VERSION_NUM >= 19274