From 835a46effb2268ccb64415330888ef31dbf38f22 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sat, 21 Feb 2015 16:50:34 +0000 Subject: [PATCH] Comments --- imgui.cpp | 7 ++++++- imgui.h | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 9ecb86462..785c45080 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6258,6 +6258,7 @@ bool ImGui::IsClipped(const ImVec2& item_size) static bool ItemAdd(const ImGuiAabb& bb, const ImGuiID* id) { + //ImGuiState& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); window->DC.LastItemID = id ? *id : 0; window->DC.LastItemAabb = bb; @@ -6266,7 +6267,11 @@ static bool ItemAdd(const ImGuiAabb& bb, const ImGuiID* id) window->DC.LastItemHovered = false; return false; } - window->DC.LastItemHovered = IsMouseHoveringBox(bb); // this is a sensible default but widgets are free to override it after calling ItemAdd() + + // This is a sensible default, but widgets are free to override it after calling ItemAdd() + const bool hovered = IsMouseHoveringBox(bb); + //const bool hovered = (g.ActiveId == 0 || (id && g.ActiveId == *id) || g.ActiveIdIsFocusedOnly) && IsMouseHoveringBox(bb); // matching the behaviour of IsHovered(), not always what the user wants? + window->DC.LastItemHovered = hovered; return true; } diff --git a/imgui.h b/imgui.h index 36dd8ce4f..4f6c8567e 100644 --- a/imgui.h +++ b/imgui.h @@ -232,8 +232,8 @@ namespace ImGui IMGUI_API float GetTextLineHeightWithSpacing(); // spacing (in pixels) between 2 consecutive lines of text == GetWindowFontSize() + GetStyle().ItemSpacing.y // ID scopes - // If you are creating repeated widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them. - // You can also use ## within your widget name to distinguish them from each others (see 'Programmer Guide') + // If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them. + // You can also use "##extra" within your widget name to distinguish them from each others (see 'Programmer Guide') IMGUI_API void PushID(const char* str_id); // push identifier into the ID stack. IDs are hash of the *entire* stack! IMGUI_API void PushID(const void* ptr_id); IMGUI_API void PushID(const int int_id);