@@ -4001,13 +4001,21 @@ bool ImGui::IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flag
4001
4001
static inline float CalcDelayFromHoveredFlags(ImGuiHoveredFlags flags)
4002
4002
{
4003
4003
ImGuiContext& g = *GImGui;
4004
- if (flags & ImGuiHoveredFlags_DelayShort)
4005
- return g.Style.HoverDelayShort;
4006
4004
if (flags & ImGuiHoveredFlags_DelayNormal)
4007
4005
return g.Style.HoverDelayNormal;
4006
+ if (flags & ImGuiHoveredFlags_DelayShort)
4007
+ return g.Style.HoverDelayShort;
4008
4008
return 0.0f;
4009
4009
}
4010
4010
4011
+ static ImGuiHoveredFlags ApplyHoverFlagsForTooltip(ImGuiHoveredFlags user_flags, ImGuiHoveredFlags shared_flags)
4012
+ {
4013
+ // Allow instance flags to override shared flags
4014
+ if (user_flags & (ImGuiHoveredFlags_DelayNone | ImGuiHoveredFlags_DelayShort | ImGuiHoveredFlags_DelayNormal))
4015
+ shared_flags &= ~(ImGuiHoveredFlags_DelayNone | ImGuiHoveredFlags_DelayShort | ImGuiHoveredFlags_DelayNormal);
4016
+ return user_flags | shared_flags;
4017
+ }
4018
+
4011
4019
// This is roughly matching the behavior of internal-facing ItemHoverable()
4012
4020
// - we allow hovering to be true when ActiveId==window->MoveID, so that clicking on non-interactive items such as a Text() item still returns true with IsItemHovered()
4013
4021
// - this should work even for non-interactive items that have no ID, so we cannot use LastItemId
@@ -4025,7 +4033,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
4025
4033
return false;
4026
4034
4027
4035
if (flags & ImGuiHoveredFlags_ForTooltip)
4028
- flags |= g.Style.HoverFlagsForTooltipNav;
4036
+ flags = ApplyHoverFlagsForTooltip(flags, g.Style.HoverFlagsForTooltipNav) ;
4029
4037
}
4030
4038
else
4031
4039
{
@@ -4035,7 +4043,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
4035
4043
return false;
4036
4044
4037
4045
if (flags & ImGuiHoveredFlags_ForTooltip)
4038
- flags |= g.Style.HoverFlagsForTooltipMouse;
4046
+ flags = ApplyHoverFlagsForTooltip(flags, g.Style.HoverFlagsForTooltipMouse) ;
4039
4047
4040
4048
IM_ASSERT((flags & (ImGuiHoveredFlags_AnyWindow | ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_NoPopupHierarchy)) == 0); // Flags not supported by this function
4041
4049
@@ -5423,7 +5431,6 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
5423
5431
// Size
5424
5432
const ImVec2 content_avail = GetContentRegionAvail();
5425
5433
ImVec2 size = ImTrunc(size_arg);
5426
- const int auto_fit_axises = ((size.x == 0.0f) ? (1 << ImGuiAxis_X) : 0x00) | ((size.y == 0.0f) ? (1 << ImGuiAxis_Y) : 0x00);
5427
5434
if (size.x <= 0.0f)
5428
5435
size.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too many issues)
5429
5436
if (size.y <= 0.0f)
@@ -7371,7 +7378,7 @@ bool ImGui::IsWindowHovered(ImGuiHoveredFlags flags)
7371
7378
// for different windows of the hierarchy. Possibly need a Hash(Current+Flags) ==> (Timer) cache.
7372
7379
// We can implement this for _Stationary because the data is linked to HoveredWindow rather than CurrentWindow.
7373
7380
if (flags & ImGuiHoveredFlags_ForTooltip)
7374
- flags |= g.Style.HoverFlagsForTooltipMouse;
7381
+ flags = ApplyHoverFlagsForTooltip(flags, g.Style.HoverFlagsForTooltipMouse) ;
7375
7382
if ((flags & ImGuiHoveredFlags_Stationary) != 0 && g.HoverWindowUnlockedStationaryId != ref_window->ID)
7376
7383
return false;
7377
7384
0 commit comments