|
@@ -1136,10 +1136,11 @@ bool ImGui::Checkbox(const char* label, bool* v)
|
|
|
ItemSize(total_bb, style.FramePadding.y);
|
|
|
const bool is_visible = ItemAdd(total_bb, id);
|
|
|
if (!is_visible)
|
|
|
- {
|
|
|
- IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
|
|
|
- return false;
|
|
|
- }
|
|
|
+ if (!g.BoxSelectState.UnclipMode || (g.LastItemData.InFlags & ImGuiItemFlags_IsMultiSelect) == 0 || !g.BoxSelectState.UnclipRect.Overlaps(total_bb)) // Extra layer of "no logic clip" for box-select support
|
|
|
+ {
|
|
|
+ IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
// Range-Selection/Multi-selection support (header)
|
|
|
bool checked = *v;
|
|
@@ -6801,13 +6802,8 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|
|
|
|
|
const bool is_multi_select = (g.LastItemData.InFlags & ImGuiItemFlags_IsMultiSelect) != 0;
|
|
|
if (!is_visible)
|
|
|
- {
|
|
|
- // Extra layer of "no logic clip" for box-select support
|
|
|
- if (!is_multi_select)
|
|
|
- return false;
|
|
|
- if (!g.BoxSelectState.UnclipMode || !g.BoxSelectState.UnclipRect.Overlaps(bb))
|
|
|
+ if (!is_multi_select || !g.BoxSelectState.UnclipMode || !g.BoxSelectState.UnclipRect.Overlaps(bb)) // Extra layer of "no logic clip" for box-select support (would be more overhead to add to ItemAdd)
|
|
|
return false;
|
|
|
- }
|
|
|
|
|
|
const bool disabled_global = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0;
|
|
|
if (disabled_item && !disabled_global) // Only testing this as an optimization
|
|
@@ -7242,9 +7238,9 @@ bool ImGui::BeginBoxSelect(ImGuiWindow* window, ImGuiID box_select_id, ImGuiMult
|
|
|
if (ms_flags & ImGuiMultiSelectFlags_BoxSelect2d)
|
|
|
if (bs->BoxSelectRectPrev.Min.x != bs->BoxSelectRectCurr.Min.x || bs->BoxSelectRectPrev.Max.x != bs->BoxSelectRectCurr.Max.x)
|
|
|
{
|
|
|
- bs->UnclipRect = bs->BoxSelectRectPrev;
|
|
|
- bs->UnclipRect.Add(bs->BoxSelectRectCurr);
|
|
|
bs->UnclipMode = true;
|
|
|
+ bs->UnclipRect = bs->BoxSelectRectPrev; // FIXME-OPT: UnclipRect x coordinates could be intersection of Prev and Curr rect on X axis.
|
|
|
+ bs->UnclipRect.Add(bs->BoxSelectRectCurr);
|
|
|
}
|
|
|
|
|
|
//GetForegroundDrawList()->AddRect(bs->UnclipRect.Min, bs->UnclipRect.Max, IM_COL32(255,0,0,200), 0.0f, 0, 3.0f);
|