mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 06:06:35 +00:00
Tweak HoverDelayClearTimer. Not exposing since I am unsure logic is viable (and is rather complex with upcoming addition of stationary logic). (#1485)
+ Tweaked default value of io.HoverDelayNormal from 0.30 to 0.35.
This commit is contained in:
parent
6cabad6e7a
commit
eec344cc1e
@ -41,6 +41,8 @@ Other changes:
|
||||
- Clipper: Rework inner logic to allow functioning with a zero-clear constructor.
|
||||
This is order to facilitate usage for language bindings (e.g cimgui or dear_binding)
|
||||
where user may not be callinga constructor manually. (#5856)
|
||||
- IsItemHovered: Tweaked default value of io.HoverDelayNormal from 0.30 to 0.35 (used when
|
||||
using the ImGuiHoveredFlags_DelayNormal flag). (#1485)
|
||||
- Tooltips: Tweak default offset for non-drag and drop tooltips so underlying items
|
||||
isn't covered as much. (Match offset for drag and drop tooltips)
|
||||
- Debug Tools: Added 'io.ConfigDebugIniSettings' option to save .ini data with extra
|
||||
@ -50,7 +52,7 @@ Other changes:
|
||||
This seems to happens on some Windows setup when peripherals disconnect, and is likely
|
||||
to also happen on browser+Emscripten. Matches similar 1.89.4 fix in SDL backend. (#6491)
|
||||
- Examples: Win32+OpenGL3: Changed DefWindowProc() to DefWindowProcW() to match other examples
|
||||
and support the example app being compiled without UNICODE. (#6516, #5725, #5961, #5975)
|
||||
and support the example app being compiled without UNICODE. (#6516, #5725, #5961, #5975) [@yenixing]
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
@ -1218,7 +1218,7 @@ ImGuiIO::ImGuiIO()
|
||||
#endif
|
||||
KeyRepeatDelay = 0.275f;
|
||||
KeyRepeatRate = 0.050f;
|
||||
HoverDelayNormal = 0.30f;
|
||||
HoverDelayNormal = 0.35f;
|
||||
HoverDelayShort = 0.10f;
|
||||
UserData = NULL;
|
||||
|
||||
@ -4549,8 +4549,9 @@ void ImGui::NewFrame()
|
||||
else if (g.HoverDelayTimer > 0.0f)
|
||||
{
|
||||
// This gives a little bit of leeway before clearing the hover timer, allowing mouse to cross gaps
|
||||
// We could expose 0.25f as io.HoverClearDelay but I am not sure of the logic yet, this is particularly subtle.
|
||||
g.HoverDelayClearTimer += g.IO.DeltaTime;
|
||||
if (g.HoverDelayClearTimer >= ImMax(0.20f, g.IO.DeltaTime * 2.0f)) // ~6 frames at 30 Hz + allow for low framerate
|
||||
if (g.HoverDelayClearTimer >= ImMax(0.25f, g.IO.DeltaTime * 2.0f)) // ~7 frames at 30 Hz + allow for low framerate
|
||||
g.HoverDelayTimer = g.HoverDelayClearTimer = 0.0f; // May want a decaying timer, in which case need to clamp at max first, based on max of caller last requested timer.
|
||||
}
|
||||
|
||||
@ -8529,7 +8530,8 @@ static void ImGui::UpdateMouseInputs()
|
||||
io.MouseDelta = ImVec2(0.0f, 0.0f);
|
||||
|
||||
// If mouse moved we re-enable mouse hovering in case it was disabled by gamepad/keyboard. In theory should use a >0.0f threshold but would need to reset in everywhere we set this to true.
|
||||
if (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f)
|
||||
const bool is_stationary = (g.IO.MouseDelta.x == 0.0f && g.IO.MouseDelta.y == 0.0f);
|
||||
if (!is_stationary)
|
||||
g.NavDisableMouseHover = false;
|
||||
|
||||
io.MousePosPrev = io.MousePos;
|
||||
|
6
imgui.h
6
imgui.h
@ -1285,8 +1285,8 @@ enum ImGuiHoveredFlags_
|
||||
ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,
|
||||
ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows,
|
||||
|
||||
// Hovering delays (for tooltips)
|
||||
ImGuiHoveredFlags_DelayNormal = 1 << 11, // Return true after io.HoverDelayNormal elapsed (~0.30 sec)
|
||||
// Mouse Hovering delays (for tooltips)
|
||||
ImGuiHoveredFlags_DelayNormal = 1 << 11, // Return true after io.HoverDelayNormal elapsed (~0.35 sec)
|
||||
ImGuiHoveredFlags_DelayShort = 1 << 12, // Return true after io.HoverDelayShort elapsed (~0.10 sec)
|
||||
ImGuiHoveredFlags_NoSharedDelay = 1 << 13, // Disable shared delay system where moving from one item to the next keeps the previous timer for a short time (standard for tooltips with long delays)
|
||||
};
|
||||
@ -1929,7 +1929,7 @@ struct ImGuiIO
|
||||
float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging.
|
||||
float KeyRepeatDelay; // = 0.275f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.).
|
||||
float KeyRepeatRate; // = 0.050f // When holding a key/button, rate at which it repeats, in seconds.
|
||||
float HoverDelayNormal; // = 0.30 sec // Delay on hovering before IsItemHovered(ImGuiHoveredFlags_DelayNormal) returns true.
|
||||
float HoverDelayNormal; // = 0.35 sec // Delay on hovering before IsItemHovered(ImGuiHoveredFlags_DelayNormal) returns true.
|
||||
float HoverDelayShort; // = 0.10 sec // Delay on hovering before IsItemHovered(ImGuiHoveredFlags_DelayShort) returns true.
|
||||
void* UserData; // = NULL // Store your own data.
|
||||
|
||||
|
@ -1919,7 +1919,6 @@ struct ImGuiContext
|
||||
|
||||
// Render
|
||||
float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list)
|
||||
ImGuiMouseCursor MouseCursor;
|
||||
|
||||
// Drag and Drop
|
||||
bool DragDropActive;
|
||||
@ -1961,11 +1960,14 @@ struct ImGuiContext
|
||||
// Hover Delay system
|
||||
ImGuiID HoverDelayId;
|
||||
ImGuiID HoverDelayIdPreviousFrame;
|
||||
float HoverDelayTimer; // Currently used IsItemHovered(), generally inferred from g.HoveredIdTimer but kept uncleared until clear timer elapse.
|
||||
float HoverDelayClearTimer; // Currently used IsItemHovered(): grace time before g.TooltipHoverTimer gets cleared.
|
||||
float HoverDelayTimer; // Currently used by IsItemHovered()
|
||||
float HoverDelayClearTimer; // Currently used by IsItemHovered(): grace time before g.TooltipHoverTimer gets cleared.
|
||||
|
||||
// Mouse state
|
||||
ImGuiMouseCursor MouseCursor;
|
||||
ImVec2 MouseLastValidPos;
|
||||
|
||||
// Widget state
|
||||
ImVec2 MouseLastValidPos;
|
||||
ImGuiInputTextState InputTextState;
|
||||
ImGuiInputTextDeactivatedState InputTextDeactivatedState;
|
||||
ImFont InputTextPasswordFont;
|
||||
@ -2142,7 +2144,6 @@ struct ImGuiContext
|
||||
NavWindowingToggleLayer = false;
|
||||
|
||||
DimBgRatio = 0.0f;
|
||||
MouseCursor = ImGuiMouseCursor_Arrow;
|
||||
|
||||
DragDropActive = DragDropWithinSource = DragDropWithinTarget = false;
|
||||
DragDropSourceFlags = ImGuiDragDropFlags_None;
|
||||
@ -2165,6 +2166,8 @@ struct ImGuiContext
|
||||
HoverDelayId = HoverDelayIdPreviousFrame = 0;
|
||||
HoverDelayTimer = HoverDelayClearTimer = 0.0f;
|
||||
|
||||
MouseCursor = ImGuiMouseCursor_Arrow;
|
||||
|
||||
TempInputId = 0;
|
||||
ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;
|
||||
ColorEditCurrentID = ColorEditSavedID = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user