mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 21:21:06 +01:00 
			
		
		
		
	(Breaking) Moved io.HoverDelayShort/io.HoverDelayNormal to style.HoverDelayShort/style.HoverDelayNormal. (#1485)
This commit is contained in:
		
							
								
								
									
										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; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user