|
@@ -5212,12 +5212,8 @@ static void FindHoveredWindow()
|
|
|
continue;
|
|
|
|
|
|
// Using the clipped AABB, a child window will typically be clipped by its parent (not always)
|
|
|
- ImRect bb(window->OuterRectClipped);
|
|
|
- if (window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize))
|
|
|
- bb.Expand(padding_regular);
|
|
|
- else
|
|
|
- bb.Expand(padding_for_resize);
|
|
|
- if (!bb.Contains(g.IO.MousePos))
|
|
|
+ ImVec2 hit_padding = (window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize)) ? padding_regular : padding_for_resize;
|
|
|
+ if (!window->OuterRectClipped.ContainsWithPad(g.IO.MousePos, hit_padding))
|
|
|
continue;
|
|
|
|
|
|
// Support for one rectangular hole in any given window
|
|
@@ -8387,9 +8383,8 @@ bool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool c
|
|
|
if (clip)
|
|
|
rect_clipped.ClipWith(g.CurrentWindow->ClipRect);
|
|
|
|
|
|
- // Expand for touch input
|
|
|
- const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding);
|
|
|
- if (!rect_for_touch.Contains(g.IO.MousePos))
|
|
|
+ // Hit testing, expanded for touch input
|
|
|
+ if (!rect_clipped.ContainsWithPad(g.IO.MousePos, g.Style.TouchExtraPadding))
|
|
|
return false;
|
|
|
return true;
|
|
|
}
|