Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions imgui_offset_rect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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