@@ -7435,18 +7435,22 @@ ImGuiMultiSelectIO* ImGui::EndMultiSelect()
7435
7435
7436
7436
// Clear selection when clicking void?
7437
7437
// We specifically test for IsMouseDragPastThreshold(0) == false to allow box-selection!
7438
- bool scope_hovered = IsWindowHovered ();
7438
+ // The InnerRect test is necessary for non-child/decorated windows.
7439
+ bool scope_hovered = IsWindowHovered () && window->InnerRect .Contains (g.IO .MousePos );
7439
7440
if (scope_hovered && (ms->Flags & ImGuiMultiSelectFlags_ScopeRect))
7440
7441
scope_hovered &= scope_rect.Contains (g.IO .MousePos );
7441
7442
if (scope_hovered && g.HoveredId == 0 && g.ActiveId == 0 )
7442
7443
{
7443
7444
if (ms->Flags & ImGuiMultiSelectFlags_BoxSelect)
7444
7445
{
7445
7446
if (!g.BoxSelectState .IsActive && !g.BoxSelectState .IsStarting && g.IO .MouseClickedCount [0 ] == 1 )
7447
+ {
7446
7448
BoxSelectStartDrag (ms->BoxSelectId , ImGuiSelectionUserData_Invalid);
7447
- SetHoveredID (ms->BoxSelectId );
7448
- if (ms->Flags & ImGuiMultiSelectFlags_ScopeRect)
7449
- SetNavID (0 , ImGuiNavLayer_Main, ms->FocusScopeId , ImRect (g.IO .MousePos , g.IO .MousePos )); // Automatically switch FocusScope for initial click from outside to box-select.
7449
+ FocusWindow (window, ImGuiFocusRequestFlags_UnlessBelowModal);
7450
+ SetHoveredID (ms->BoxSelectId );
7451
+ if (ms->Flags & ImGuiMultiSelectFlags_ScopeRect)
7452
+ SetNavID (0 , ImGuiNavLayer_Main, ms->FocusScopeId , ImRect (g.IO .MousePos , g.IO .MousePos )); // Automatically switch FocusScope for initial click from void to box-select.
7453
+ }
7450
7454
}
7451
7455
7452
7456
if (ms->Flags & ImGuiMultiSelectFlags_ClearOnClickVoid)
0 commit comments