mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-27 16:29:02 +08:00
Internals: Added ItemUnclipByLog for use by ItemAdd(), as we expected to add more.
This commit is contained in:
parent
0fce21e890
commit
9aec6d7217
13
imgui.cpp
13
imgui.cpp
@ -4237,7 +4237,7 @@ bool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id)
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
if (!bb.Overlaps(window->ClipRect))
|
||||
if (id == 0 || (id != g.ActiveId && id != g.ActiveIdPreviousFrame && id != g.NavId && id != g.NavActivateId))
|
||||
if (!g.LogEnabled)
|
||||
if (!g.ItemUnclipByLog)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@ -10173,15 +10173,12 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu
|
||||
#endif
|
||||
|
||||
// Clipping test
|
||||
// (this is a modified copy of IsClippedEx() so we can reuse the is_rect_visible value)
|
||||
//const bool is_clipped = IsClippedEx(bb, id);
|
||||
//if (is_clipped)
|
||||
// return false;
|
||||
// (this is an inline copy of IsClippedEx() so we can reuse the is_rect_visible value, otherwise we'd do 'if (IsClippedEx(bb, id)) return false')
|
||||
// g.NavActivateId is not necessarily == g.NavId, in the case of remote activation (e.g. shortcuts)
|
||||
const bool is_rect_visible = bb.Overlaps(window->ClipRect);
|
||||
if (!is_rect_visible)
|
||||
if (id == 0 || (id != g.ActiveId && id != g.ActiveIdPreviousFrame && id != g.NavId && id != g.NavActivateId))
|
||||
if (!g.LogEnabled)
|
||||
if (!g.ItemUnclipByLog)
|
||||
return false;
|
||||
|
||||
// [DEBUG]
|
||||
@ -13585,7 +13582,7 @@ void ImGui::LogBegin(ImGuiLogType type, int auto_open_depth)
|
||||
IM_ASSERT(g.LogEnabled == false);
|
||||
IM_ASSERT(g.LogFile == NULL);
|
||||
IM_ASSERT(g.LogBuffer.empty());
|
||||
g.LogEnabled = true;
|
||||
g.LogEnabled = g.ItemUnclipByLog = true;
|
||||
g.LogType = type;
|
||||
g.LogNextPrefix = g.LogNextSuffix = NULL;
|
||||
g.LogDepthRef = window->DC.TreeDepth;
|
||||
@ -13684,7 +13681,7 @@ void ImGui::LogFinish()
|
||||
break;
|
||||
}
|
||||
|
||||
g.LogEnabled = false;
|
||||
g.LogEnabled = g.ItemUnclipByLog = false;
|
||||
g.LogType = ImGuiLogType_None;
|
||||
g.LogFile = NULL;
|
||||
g.LogBuffer.clear();
|
||||
|
@ -1966,10 +1966,11 @@ struct ImGuiContext
|
||||
ImGuiID DebugHookIdInfo; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by ID Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
|
||||
ImGuiID HoveredId; // Hovered widget, filled during the frame
|
||||
ImGuiID HoveredIdPreviousFrame;
|
||||
bool HoveredIdAllowOverlap;
|
||||
bool HoveredIdDisabled; // At least one widget passed the rect test, but has been discarded by disabled flag or popup inhibit. May be true even if HoveredId == 0.
|
||||
float HoveredIdTimer; // Measure contiguous hovering time
|
||||
float HoveredIdNotActiveTimer; // Measure contiguous hovering time where the item has not been active
|
||||
bool HoveredIdAllowOverlap;
|
||||
bool HoveredIdDisabled; // At least one widget passed the rect test, but has been discarded by disabled flag or popup inhibit. May be true even if HoveredId == 0.
|
||||
bool ItemUnclipByLog; // Disable ItemAdd() clipping, essentially a memory-locality friendly copy of LogEnabled
|
||||
ImGuiID ActiveId; // Active widget
|
||||
ImGuiID ActiveIdIsAlive; // Active widget has been seen this frame (we can't use a bool as the ActiveId may change within the frame)
|
||||
float ActiveIdTimer;
|
||||
@ -2036,11 +2037,11 @@ struct ImGuiContext
|
||||
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusedWindow'
|
||||
ImGuiID NavId; // Focused item for navigation
|
||||
ImGuiID NavFocusScopeId; // Focused focus scope (e.g. selection code often wants to "clear other items" when landing on an item of the same scope)
|
||||
ImVector<ImGuiFocusScopeData> NavFocusRoute; // Reversed copy focus scope stack for NavId (should contains NavFocusScopeId). This essentially follow the window->ParentWindowForFocusRoute chain.
|
||||
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItem()
|
||||
ImGuiID NavActivateDownId; // ~~ IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyDown(ImGuiKey_NavGamepadActivate) ? NavId : 0
|
||||
ImGuiID NavActivatePressedId; // ~~ IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate) ? NavId : 0 (no repeat)
|
||||
ImGuiActivateFlags NavActivateFlags;
|
||||
ImVector<ImGuiFocusScopeData> NavFocusRoute; // Reversed copy focus scope stack for NavId (should contains NavFocusScopeId). This essentially follow the window->ParentWindowForFocusRoute chain.
|
||||
ImGuiID NavHighlightActivatedId;
|
||||
float NavHighlightActivatedTimer;
|
||||
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
||||
@ -2277,6 +2278,7 @@ struct ImGuiContext
|
||||
HoveredIdAllowOverlap = false;
|
||||
HoveredIdDisabled = false;
|
||||
HoveredIdTimer = HoveredIdNotActiveTimer = 0.0f;
|
||||
ItemUnclipByLog = false;
|
||||
ActiveId = 0;
|
||||
ActiveIdIsAlive = 0;
|
||||
ActiveIdTimer = 0.0f;
|
||||
|
Loading…
Reference in New Issue
Block a user