mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-22 15:46:35 +00:00
(Breaking) Moved io.HoverDelayShort/io.HoverDelayNormal to style.HoverDelayShort/style.HoverDelayNormal. (#1485)
This commit is contained in:
parent
f09ef23ae6
commit
d4b94bd65b
@ -34,6 +34,13 @@ HOW TO UPDATE?
|
||||
VERSION 1.89.7 WIP (In Progress)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
Breaking changes:
|
||||
|
||||
- Moved io.HoverDelayShort/io.HoverDelayNormal to style.HoverDelayShort/style.HoverDelayNormal.
|
||||
As the fields were added in 1.89 and expected to be left unchanged by most users, or only
|
||||
tweaked once during app initialisation, we are exceptionally accepting the breakage.
|
||||
Majority of users should not even notice.
|
||||
|
||||
Other changes:
|
||||
|
||||
- Tables: Fixed a regression in 1.89.6 leading to the first column of tables with either
|
||||
@ -43,8 +50,8 @@ Other changes:
|
||||
where user may not be callinga constructor manually. (#5856)
|
||||
- Modals: In the case of nested modal, made sure that focused or appearing windows are
|
||||
moved below the lowest blocking modal (rather than the highest one). (#4317)
|
||||
- IsItemHovered: Tweaked default value of io.HoverDelayNormal from 0.30 to 0.40,
|
||||
Tweaked default value of io.HoverDelayShort from 0.10 to 0.15. (#1485)
|
||||
- IsItemHovered: Tweaked default value of style.HoverDelayNormal from 0.30 to 0.40,
|
||||
Tweaked default value of style.HoverDelayShort from 0.10 to 0.15. (#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
|
||||
|
27
imgui.cpp
27
imgui.cpp
@ -397,6 +397,7 @@ CODE
|
||||
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
||||
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||
|
||||
- 2023/06/20 (1.89.7) - moved io.HoverDelayShort/io.HoverDelayNormal to style.HoverDelayShort/style.HoverDelayNormal. As the fields were added in 1.89 and expected to be left unchanged by most users, or only tweaked once during app initialization, we are exceptionally accepting the breakage.
|
||||
- 2023/05/30 (1.89.6) - backends: renamed "imgui_impl_sdlrenderer.cpp" to "imgui_impl_sdlrenderer2.cpp" and "imgui_impl_sdlrenderer.h" to "imgui_impl_sdlrenderer2.h". This is in prevision for the future release of SDL3.
|
||||
- 2023/05/22 (1.89.6) - listbox: commented out obsolete/redirecting functions that were marked obsolete more than two years ago:
|
||||
- ListBoxHeader() -> use BeginListBox() (note how two variants of ListBoxHeader() existed. Check commented versions in imgui.h for reference)
|
||||
@ -1162,6 +1163,10 @@ ImGuiStyle::ImGuiStyle()
|
||||
CurveTessellationTol = 1.25f; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
|
||||
CircleTessellationMaxError = 0.30f; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry.
|
||||
|
||||
// Behaviors
|
||||
HoverDelayShort = 0.15f; // Delay for IsItemHovered(ImGuiHoveredFlags_DelayShort). Usually used along with HoverStationaryDelay.
|
||||
HoverDelayNormal = 0.40f; // Delay for IsItemHovered(ImGuiHoveredFlags_DelayNormal). "
|
||||
|
||||
// Default theme
|
||||
ImGui::StyleColorsDark(this);
|
||||
}
|
||||
@ -1210,16 +1215,10 @@ ImGuiIO::ImGuiIO()
|
||||
IniSavingRate = 5.0f;
|
||||
IniFilename = "imgui.ini"; // Important: "imgui.ini" is relative to current working dir, most apps will want to lock this to an absolute path (e.g. same path as executables).
|
||||
LogFilename = "imgui_log.txt";
|
||||
MouseDoubleClickTime = 0.30f;
|
||||
MouseDoubleClickMaxDist = 6.0f;
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||
for (int i = 0; i < ImGuiKey_COUNT; i++)
|
||||
KeyMap[i] = -1;
|
||||
#endif
|
||||
KeyRepeatDelay = 0.275f;
|
||||
KeyRepeatRate = 0.050f;
|
||||
HoverDelayShort = 0.15f;
|
||||
HoverDelayNormal = 0.40f;
|
||||
UserData = NULL;
|
||||
|
||||
Fonts = NULL;
|
||||
@ -1228,6 +1227,12 @@ ImGuiIO::ImGuiIO()
|
||||
FontAllowUserScaling = false;
|
||||
DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
|
||||
|
||||
MouseDoubleClickTime = 0.30f;
|
||||
MouseDoubleClickMaxDist = 6.0f;
|
||||
MouseDragThreshold = 6.0f;
|
||||
KeyRepeatDelay = 0.275f;
|
||||
KeyRepeatRate = 0.050f;
|
||||
|
||||
// Miscellaneous options
|
||||
MouseDrawCursor = false;
|
||||
#ifdef __APPLE__
|
||||
@ -3982,9 +3987,9 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
||||
// (some ideas: https://www.nngroup.com/articles/timing-exposing-content)
|
||||
float delay;
|
||||
if (flags & ImGuiHoveredFlags_DelayShort)
|
||||
delay = g.IO.HoverDelayShort;
|
||||
delay = g.Style.HoverDelayShort;
|
||||
else if (flags & ImGuiHoveredFlags_DelayNormal)
|
||||
delay = g.IO.HoverDelayNormal;
|
||||
delay = g.Style.HoverDelayNormal;
|
||||
else
|
||||
delay = 0.0f;
|
||||
if (delay > 0.0f)
|
||||
@ -3993,7 +3998,8 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
||||
if ((flags & ImGuiHoveredFlags_NoSharedDelay) && (g.HoverItemDelayIdPreviousFrame != hover_delay_id))
|
||||
g.HoverItemDelayTimer = 0.0f;
|
||||
g.HoverItemDelayId = hover_delay_id;
|
||||
return g.HoverItemDelayTimer >= delay;
|
||||
if (g.HoverItemDelayTimer < delay)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -4549,7 +4555,7 @@ void ImGui::NewFrame()
|
||||
else if (g.HoverItemDelayTimer > 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.
|
||||
// We could expose 0.25f as style.HoverClearDelay but I am not sure of the logic yet, this is particularly subtle.
|
||||
g.HoverItemDelayClearTimer += g.IO.DeltaTime;
|
||||
if (g.HoverItemDelayClearTimer >= ImMax(0.25f, g.IO.DeltaTime * 2.0f)) // ~7 frames at 30 Hz + allow for low framerate
|
||||
g.HoverItemDelayTimer = g.HoverItemDelayClearTimer = 0.0f; // May want a decaying timer, in which case need to clamp at max first, based on max of caller last requested timer.
|
||||
@ -7243,6 +7249,7 @@ bool ImGui::IsWindowHovered(ImGuiHoveredFlags flags)
|
||||
if (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))
|
||||
if (g.ActiveId != 0 && !g.ActiveIdAllowOverlap && g.ActiveId != ref_window->MoveId)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
25
imgui.h
25
imgui.h
@ -23,7 +23,7 @@
|
||||
// Library Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||
#define IMGUI_VERSION "1.89.7 WIP"
|
||||
#define IMGUI_VERSION_NUM 18963
|
||||
#define IMGUI_VERSION_NUM 18964
|
||||
#define IMGUI_HAS_TABLE
|
||||
|
||||
/*
|
||||
@ -1286,8 +1286,8 @@ enum ImGuiHoveredFlags_
|
||||
ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows,
|
||||
|
||||
// Mouse Hovering delays (for tooltips)
|
||||
ImGuiHoveredFlags_DelayShort = 1 << 11, // IsItemHovered() only: Return true after io.HoverDelayShort elapsed (~0.15 sec)
|
||||
ImGuiHoveredFlags_DelayNormal = 1 << 12, // IsItemHovered() only: Return true after io.HoverDelayNormal elapsed (~0.40 sec)
|
||||
ImGuiHoveredFlags_DelayShort = 1 << 11, // IsItemHovered() only: Return true after style.HoverDelayShort elapsed (~0.15 sec)
|
||||
ImGuiHoveredFlags_DelayNormal = 1 << 12, // IsItemHovered() only: Return true after style.HoverDelayNormal elapsed (~0.40 sec)
|
||||
ImGuiHoveredFlags_NoSharedDelay = 1 << 13, // IsItemHovered() only: 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)
|
||||
};
|
||||
|
||||
@ -1890,6 +1890,10 @@ struct ImGuiStyle
|
||||
float CircleTessellationMaxError; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry.
|
||||
ImVec4 Colors[ImGuiCol_COUNT];
|
||||
|
||||
// Behaviors
|
||||
float HoverDelayShort; // Delay for IsItemHovered(ImGuiHoveredFlags_DelayShort). Usually used along with HoverStationaryDelay.
|
||||
float HoverDelayNormal; // Delay for IsItemHovered(ImGuiHoveredFlags_DelayNormal). "
|
||||
|
||||
IMGUI_API ImGuiStyle();
|
||||
IMGUI_API void ScaleAllSizes(float scale_factor);
|
||||
};
|
||||
@ -1924,13 +1928,6 @@ struct ImGuiIO
|
||||
float IniSavingRate; // = 5.0f // Minimum time between saving positions/sizes to .ini file, in seconds.
|
||||
const char* IniFilename; // = "imgui.ini" // Path to .ini file (important: default "imgui.ini" is relative to current working dir!). Set NULL to disable automatic .ini loading/saving or if you want to manually call LoadIniSettingsXXX() / SaveIniSettingsXXX() functions.
|
||||
const char* LogFilename; // = "imgui_log.txt"// Path to .log file (default parameter to ImGui::LogToFile when no file is specified).
|
||||
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
||||
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
||||
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 HoverDelayShort; // = 0.15 sec // Delay before IsItemHovered(ImGuiHoveredFlags_DelayShort) returns true.
|
||||
float HoverDelayNormal; // = 0.40 sec // Delay before IsItemHovered(ImGuiHoveredFlags_DelayNormal) returns true.
|
||||
void* UserData; // = NULL // Store your own data.
|
||||
|
||||
ImFontAtlas*Fonts; // <auto> // Font atlas: load, rasterize and pack one or more fonts into a single texture.
|
||||
@ -1950,6 +1947,14 @@ struct ImGuiIO
|
||||
bool ConfigWindowsMoveFromTitleBarOnly; // = false // Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar.
|
||||
float ConfigMemoryCompactTimer; // = 60.0f // Timer (in seconds) to free transient windows/tables memory buffers when unused. Set to -1.0f to disable.
|
||||
|
||||
// Inputs Behaviors
|
||||
// (other variables, ones which are expected to be tweaked within UI code, are exposed in ImGuiStyle)
|
||||
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
||||
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
||||
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.
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Debug options
|
||||
//------------------------------------------------------------------
|
||||
|
@ -6224,6 +6224,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
|
||||
ImGui::SeparatorText("Misc");
|
||||
ImGui::SliderFloat2("DisplaySafeAreaPadding", (float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f"); ImGui::SameLine(); HelpMarker("Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured).");
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user