@@ -7262,18 +7262,22 @@ ImGuiMultiSelectIO* ImGui::EndMultiSelect()
7262
7262
7263
7263
// Clear selection when clicking void?
7264
7264
// We specifically test for IsMouseDragPastThreshold(0) == false to allow box-selection!
7265
- bool scope_hovered = IsWindowHovered ();
7265
+ // The InnerRect test is necessary for non-child/decorated windows.
7266
+ bool scope_hovered = IsWindowHovered () && window->InnerRect .Contains (g.IO .MousePos );
7266
7267
if (scope_hovered && (ms->Flags & ImGuiMultiSelectFlags_ScopeRect))
7267
7268
scope_hovered &= scope_rect.Contains (g.IO .MousePos );
7268
7269
if (scope_hovered && g.HoveredId == 0 && g.ActiveId == 0 )
7269
7270
{
7270
7271
if (ms->Flags & ImGuiMultiSelectFlags_BoxSelect)
7271
7272
{
7272
7273
if (!g.BoxSelectState .IsActive && !g.BoxSelectState .IsStarting && g.IO .MouseClickedCount [0 ] == 1 )
7274
+ {
7273
7275
BoxSelectStartDrag (ms->BoxSelectId , ImGuiSelectionUserData_Invalid);
7274
- SetHoveredID (ms->BoxSelectId );
7275
- if (ms->Flags & ImGuiMultiSelectFlags_ScopeRect)
7276
- SetNavID (0 , ImGuiNavLayer_Main, ms->FocusScopeId , ImRect (g.IO .MousePos , g.IO .MousePos )); // Automatically switch FocusScope for initial click from outside to box-select.
7276
+ FocusWindow (window, ImGuiFocusRequestFlags_UnlessBelowModal);
7277
+ SetHoveredID (ms->BoxSelectId );
7278
+ if (ms->Flags & ImGuiMultiSelectFlags_ScopeRect)
7279
+ SetNavID (0 , ImGuiNavLayer_Main, ms->FocusScopeId , ImRect (g.IO .MousePos , g.IO .MousePos )); // Automatically switch FocusScope for initial click from void to box-select.
7280
+ }
7277
7281
}
7278
7282
7279
7283
if (ms->Flags & ImGuiMultiSelectFlags_ClearOnClickVoid)
0 commit comments