MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / IsMouseHoveringRect

Method IsMouseHoveringRect

KBotExt/imgui/imgui.cpp:8343–8357  ·  view source on GitHub ↗

Test if mouse cursor is hovering given rectangle NB- Rectangle is clipped by our current clip setting NB- Expand the rectangle to be generous on imprecise inputs systems (g.Style.TouchExtraPadding)

Source from the content-addressed store, hash-verified

8341// NB- Rectangle is clipped by our current clip setting
8342// NB- Expand the rectangle to be generous on imprecise inputs systems (g.Style.TouchExtraPadding)
8343bool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip)
8344{
8345 ImGuiContext& g = *GImGui;
8346
8347 // Clip
8348 ImRect rect_clipped(r_min, r_max);
8349 if (clip)
8350 rect_clipped.ClipWith(g.CurrentWindow->ClipRect);
8351
8352 // Expand for touch input
8353 const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding);
8354 if (!rect_for_touch.Contains(g.IO.MousePos))
8355 return false;
8356 return true;
8357}
8358
8359// Return if a mouse click/drag went past the given threshold. Valid to call during the MouseReleased frame.
8360// [Internal] This doesn't test if the button is pressed

Callers

nothing calls this directly

Calls 1

ContainsMethod · 0.80

Tested by

no test coverage detected