Update ImGui to 10fe2b67.

This commit is contained in:
Bartosz Taudul 2024-09-20 19:48:23 +02:00
parent fc303d9594
commit a47a51453c
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
7 changed files with 66 additions and 34 deletions

View File

@ -1,4 +1,4 @@
// dear imgui, v1.91.2 // dear imgui, v1.91.3 WIP
// (main code and documentation) // (main code and documentation)
// Help: // Help:
@ -79,7 +79,7 @@ CODE
// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!) // [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!)
// [SECTION] ID STACK // [SECTION] ID STACK
// [SECTION] INPUTS // [SECTION] INPUTS
// [SECTION] ERROR CHECKING // [SECTION] ERROR CHECKING, STATE RECOVERY
// [SECTION] ITEM SUBMISSION // [SECTION] ITEM SUBMISSION
// [SECTION] LAYOUT // [SECTION] LAYOUT
// [SECTION] SCROLLING // [SECTION] SCROLLING
@ -1433,6 +1433,7 @@ ImGuiIO::ImGuiIO()
ConfigDragClickToInputText = false; ConfigDragClickToInputText = false;
ConfigWindowsResizeFromEdges = true; ConfigWindowsResizeFromEdges = true;
ConfigWindowsMoveFromTitleBarOnly = false; ConfigWindowsMoveFromTitleBarOnly = false;
ConfigScrollbarScrollByPage = true;
ConfigMemoryCompactTimer = 60.0f; ConfigMemoryCompactTimer = 60.0f;
ConfigDebugIsDebuggerPresent = false; ConfigDebugIsDebuggerPresent = false;
ConfigDebugHighlightIdConflicts = true; ConfigDebugHighlightIdConflicts = true;
@ -8297,8 +8298,10 @@ void ImGui::PopItemFlag()
// - Those can be nested but it cannot be used to enable an already disabled section (a single BeginDisabled(true) in the stack is enough to keep everything disabled) // - Those can be nested but it cannot be used to enable an already disabled section (a single BeginDisabled(true) in the stack is enough to keep everything disabled)
// - Visually this is currently altering alpha, but it is expected that in a future styling system this would work differently. // - Visually this is currently altering alpha, but it is expected that in a future styling system this would work differently.
// - Feedback welcome at https://github.com/ocornut/imgui/issues/211 // - Feedback welcome at https://github.com/ocornut/imgui/issues/211
// - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(False)/EndDisabled() best to avoid it. // - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions.
// (as a micro-optimisation if you can avoid calling BeginDisabled(false)/EndDisabled() tens of thousands of times by doing a local check, it won't hurt)
// - Optimized shortcuts instead of PushStyleVar() + PushItemFlag() // - Optimized shortcuts instead of PushStyleVar() + PushItemFlag()
// - Note: mixing up BeginDisabled() and PushItemFlag(ImGuiItemFlags_Disabled) is currently NOT SUPPORTED.
void ImGui::BeginDisabled(bool disabled) void ImGui::BeginDisabled(bool disabled)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
@ -10695,7 +10698,15 @@ bool ImGui::Shortcut(ImGuiKeyChord key_chord, ImGuiInputFlags flags, ImGuiID own
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// [SECTION] ERROR CHECKING // [SECTION] ERROR CHECKING, STATE RECOVERY
//-----------------------------------------------------------------------------
// - DebugCheckVersionAndDataLayout() (called via IMGUI_CHECKVERSION() macros)
// - ErrorCheckUsingSetCursorPosToExtendParentBoundaries()
// - ErrorCheckNewFrameSanityChecks()
// - ErrorCheckEndFrameSanityChecks()
// - ErrorCheckEndFrameRecover()
// - ErrorCheckEndWindowRecover()
// - ImGuiStackSizes
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Verify ABI compatibility between caller code and compiled version of Dear ImGui. This helps detects some build issues. // Verify ABI compatibility between caller code and compiled version of Dear ImGui. This helps detects some build issues.
@ -10880,6 +10891,19 @@ static void ImGui::ErrorCheckEndFrameSanityChecks()
IM_ASSERT_USER_ERROR(g.GroupStack.Size == 0, "Missing EndGroup call!"); IM_ASSERT_USER_ERROR(g.GroupStack.Size == 0, "Missing EndGroup call!");
} }
// Default implementation of ImGuiErrorLogCallback that pipe errors to DebugLog: appears in tty + Tools->DebugLog
void ImGui::ErrorLogCallbackToDebugLog(void*, const char* fmt, ...)
{
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
va_list args;
va_start(args, fmt);
DebugLogV(fmt, args);
va_end(args);
#else
IM_UNUSED(fmt);
#endif
}
// Experimental recovery from incorrect usage of BeginXXX/EndXXX/PushXXX/PopXXX calls. // Experimental recovery from incorrect usage of BeginXXX/EndXXX/PushXXX/PopXXX calls.
// Must be called during or before EndFrame(). // Must be called during or before EndFrame().
// This is generally flawed as we are not necessarily End/Popping things in the right order. // This is generally flawed as we are not necessarily End/Popping things in the right order.
@ -10900,12 +10924,12 @@ void ImGui::ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, voi
} }
if (window->Flags & ImGuiWindowFlags_ChildWindow) if (window->Flags & ImGuiWindowFlags_ChildWindow)
{ {
if (log_callback) log_callback(user_data, "Recovered from missing EndChild() for '%s'", window->Name); if (log_callback) log_callback(user_data, "Recovered from missing EndChild() for '%s'\n", window->Name);
EndChild(); EndChild();
} }
else else
{ {
if (log_callback) log_callback(user_data, "Recovered from missing End() for '%s'", window->Name); if (log_callback) log_callback(user_data, "Recovered from missing End() for '%s'\n", window->Name);
End(); End();
} }
} }
@ -10917,7 +10941,7 @@ void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, vo
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
while (g.CurrentTable && (g.CurrentTable->OuterWindow == g.CurrentWindow || g.CurrentTable->InnerWindow == g.CurrentWindow)) while (g.CurrentTable && (g.CurrentTable->OuterWindow == g.CurrentWindow || g.CurrentTable->InnerWindow == g.CurrentWindow))
{ {
if (log_callback) log_callback(user_data, "Recovered from missing EndTable() in '%s'", g.CurrentTable->OuterWindow->Name); if (log_callback) log_callback(user_data, "Recovered from missing EndTable() in '%s'\n", g.CurrentTable->OuterWindow->Name);
EndTable(); EndTable();
} }
@ -10926,32 +10950,32 @@ void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, vo
IM_ASSERT(window != NULL); IM_ASSERT(window != NULL);
while (g.CurrentTabBar != NULL) //-V1044 while (g.CurrentTabBar != NULL) //-V1044
{ {
if (log_callback) log_callback(user_data, "Recovered from missing EndTabBar() in '%s'", window->Name); if (log_callback) log_callback(user_data, "Recovered from missing EndTabBar() in '%s'\n", window->Name);
EndTabBar(); EndTabBar();
} }
while (g.CurrentMultiSelect != NULL && g.CurrentMultiSelect->Storage->Window == window) while (g.CurrentMultiSelect != NULL && g.CurrentMultiSelect->Storage->Window == window)
{ {
if (log_callback) log_callback(user_data, "Recovered from missing EndMultiSelect() in '%s'", window->Name); if (log_callback) log_callback(user_data, "Recovered from missing EndMultiSelect() in '%s'\n", window->Name);
EndMultiSelect(); EndMultiSelect();
} }
while (window->DC.TreeDepth > 0) while (window->DC.TreeDepth > 0)
{ {
if (log_callback) log_callback(user_data, "Recovered from missing TreePop() in '%s'", window->Name); if (log_callback) log_callback(user_data, "Recovered from missing TreePop() in '%s'\n", window->Name);
TreePop(); TreePop();
} }
while (g.GroupStack.Size > stack_sizes->SizeOfGroupStack) //-V1044 while (g.GroupStack.Size > stack_sizes->SizeOfGroupStack) //-V1044
{ {
if (log_callback) log_callback(user_data, "Recovered from missing EndGroup() in '%s'", window->Name); if (log_callback) log_callback(user_data, "Recovered from missing EndGroup() in '%s'\n", window->Name);
EndGroup(); EndGroup();
} }
while (window->IDStack.Size > 1) while (window->IDStack.Size > 1)
{ {
if (log_callback) log_callback(user_data, "Recovered from missing PopID() in '%s'", window->Name); if (log_callback) log_callback(user_data, "Recovered from missing PopID() in '%s'\n", window->Name);
PopID(); PopID();
} }
while (g.DisabledStackSize > stack_sizes->SizeOfDisabledStack) //-V1044 while (g.DisabledStackSize > stack_sizes->SizeOfDisabledStack) //-V1044
{ {
if (log_callback) log_callback(user_data, "Recovered from missing EndDisabled() in '%s'", window->Name); if (log_callback) log_callback(user_data, "Recovered from missing EndDisabled() in '%s'\n", window->Name);
if (g.CurrentItemFlags & ImGuiItemFlags_Disabled) if (g.CurrentItemFlags & ImGuiItemFlags_Disabled)
EndDisabled(); EndDisabled();
else else
@ -10962,27 +10986,27 @@ void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, vo
} }
while (g.ColorStack.Size > stack_sizes->SizeOfColorStack) while (g.ColorStack.Size > stack_sizes->SizeOfColorStack)
{ {
if (log_callback) log_callback(user_data, "Recovered from missing PopStyleColor() in '%s' for ImGuiCol_%s", window->Name, GetStyleColorName(g.ColorStack.back().Col)); if (log_callback) log_callback(user_data, "Recovered from missing PopStyleColor() in '%s' for ImGuiCol_%s\n", window->Name, GetStyleColorName(g.ColorStack.back().Col));
PopStyleColor(); PopStyleColor();
} }
while (g.ItemFlagsStack.Size > stack_sizes->SizeOfItemFlagsStack) //-V1044 while (g.ItemFlagsStack.Size > stack_sizes->SizeOfItemFlagsStack) //-V1044
{ {
if (log_callback) log_callback(user_data, "Recovered from missing PopItemFlag() in '%s'", window->Name); if (log_callback) log_callback(user_data, "Recovered from missing PopItemFlag() in '%s'\n", window->Name);
PopItemFlag(); PopItemFlag();
} }
while (g.StyleVarStack.Size > stack_sizes->SizeOfStyleVarStack) //-V1044 while (g.StyleVarStack.Size > stack_sizes->SizeOfStyleVarStack) //-V1044
{ {
if (log_callback) log_callback(user_data, "Recovered from missing PopStyleVar() in '%s'", window->Name); if (log_callback) log_callback(user_data, "Recovered from missing PopStyleVar() in '%s'\n", window->Name);
PopStyleVar(); PopStyleVar();
} }
while (g.FontStack.Size > stack_sizes->SizeOfFontStack) //-V1044 while (g.FontStack.Size > stack_sizes->SizeOfFontStack) //-V1044
{ {
if (log_callback) log_callback(user_data, "Recovered from missing PopFont() in '%s'", window->Name); if (log_callback) log_callback(user_data, "Recovered from missing PopFont() in '%s'\n", window->Name);
PopFont(); PopFont();
} }
while (g.FocusScopeStack.Size > stack_sizes->SizeOfFocusScopeStack + 1) //-V1044 while (g.FocusScopeStack.Size > stack_sizes->SizeOfFocusScopeStack + 1) //-V1044
{ {
if (log_callback) log_callback(user_data, "Recovered from missing PopFocusScope() in '%s'", window->Name); if (log_callback) log_callback(user_data, "Recovered from missing PopFocusScope() in '%s'\n", window->Name);
PopFocusScope(); PopFocusScope();
} }
} }

View File

@ -1,4 +1,4 @@
// dear imgui, v1.91.2 // dear imgui, v1.91.3 WIP
// (headers) // (headers)
// Help: // Help:
@ -28,8 +28,8 @@
// Library Version // Library Version
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
#define IMGUI_VERSION "1.91.2" #define IMGUI_VERSION "1.91.3 WIP"
#define IMGUI_VERSION_NUM 19120 #define IMGUI_VERSION_NUM 19121
#define IMGUI_HAS_TABLE #define IMGUI_HAS_TABLE
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch #define IMGUI_HAS_VIEWPORT // Viewport WIP branch
#define IMGUI_HAS_DOCK // Docking WIP branch #define IMGUI_HAS_DOCK // Docking WIP branch
@ -2340,6 +2340,7 @@ struct ImGuiIO
bool ConfigDragClickToInputText; // = false // [BETA] Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). Not desirable on devices without a keyboard. bool ConfigDragClickToInputText; // = false // [BETA] Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). Not desirable on devices without a keyboard.
bool ConfigWindowsResizeFromEdges; // = true // Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag) bool ConfigWindowsResizeFromEdges; // = true // Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag)
bool ConfigWindowsMoveFromTitleBarOnly; // = false // Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar. bool ConfigWindowsMoveFromTitleBarOnly; // = false // Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar.
bool ConfigScrollbarScrollByPage; // = true // Enable scrolling page by page when clicking outside the scrollbar grab. When disabled, always scroll to clicked location. When enabled, Shift+Click scrolls to clicked location.
float ConfigMemoryCompactTimer; // = 60.0f // Timer (in seconds) to free transient windows/tables memory buffers when unused. Set to -1.0f to disable. float ConfigMemoryCompactTimer; // = 60.0f // Timer (in seconds) to free transient windows/tables memory buffers when unused. Set to -1.0f to disable.
// Inputs Behaviors // Inputs Behaviors

View File

@ -1,4 +1,4 @@
// dear imgui, v1.91.2 // dear imgui, v1.91.3 WIP
// (demo code) // (demo code)
// Help: // Help:
@ -593,6 +593,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
ImGui::Checkbox("io.ConfigWindowsResizeFromEdges", &io.ConfigWindowsResizeFromEdges); ImGui::Checkbox("io.ConfigWindowsResizeFromEdges", &io.ConfigWindowsResizeFromEdges);
ImGui::SameLine(); HelpMarker("Enable resizing of windows from their edges and from the lower-left corner.\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback."); ImGui::SameLine(); HelpMarker("Enable resizing of windows from their edges and from the lower-left corner.\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback.");
ImGui::Checkbox("io.ConfigWindowsMoveFromTitleBarOnly", &io.ConfigWindowsMoveFromTitleBarOnly); ImGui::Checkbox("io.ConfigWindowsMoveFromTitleBarOnly", &io.ConfigWindowsMoveFromTitleBarOnly);
ImGui::Checkbox("io.ConfigScrollbarScrollByPage", &io.ConfigScrollbarScrollByPage);
ImGui::SameLine(); HelpMarker("Enable scrolling page by page when clicking outside the scrollbar grab.\nWhen disabled, always scroll to clicked location.\nWhen enabled, Shift+Click scrolls to clicked location.");
ImGui::Checkbox("io.ConfigMacOSXBehaviors", &io.ConfigMacOSXBehaviors); ImGui::Checkbox("io.ConfigMacOSXBehaviors", &io.ConfigMacOSXBehaviors);
ImGui::SameLine(); HelpMarker("Swap Cmd<>Ctrl keys, enable various MacOS style behaviors."); ImGui::SameLine(); HelpMarker("Swap Cmd<>Ctrl keys, enable various MacOS style behaviors.");
ImGui::Text("Also see Style->Rendering for rendering options."); ImGui::Text("Also see Style->Rendering for rendering options.");

View File

@ -1,4 +1,4 @@
// dear imgui, v1.91.2 // dear imgui, v1.91.3 WIP
// (drawing and font code) // (drawing and font code)
/* /*

View File

@ -1,4 +1,4 @@
// dear imgui, v1.91.2 // dear imgui, v1.91.3 WIP
// (internal structures/api) // (internal structures/api)
// You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility. // You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility.
@ -845,7 +845,7 @@ enum ImGuiDataTypePrivate_
enum ImGuiItemFlagsPrivate_ enum ImGuiItemFlagsPrivate_
{ {
// Controlled by user // Controlled by user
ImGuiItemFlags_Disabled = 1 << 10, // false // Disable interactions (DOES NOT affect visuals, see BeginDisabled()/EndDisabled() for full disable feature, and github #211). ImGuiItemFlags_Disabled = 1 << 10, // false // Disable interactions (DOES NOT affect visuals. DO NOT mix direct use of this with BeginDisabled(). See BeginDisabled()/EndDisabled() for full disable feature, and github #211).
ImGuiItemFlags_ReadOnly = 1 << 11, // false // [ALPHA] Allow hovering interactions but underlying value is not changed. ImGuiItemFlags_ReadOnly = 1 << 11, // false // [ALPHA] Allow hovering interactions but underlying value is not changed.
ImGuiItemFlags_MixedValue = 1 << 12, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets) ImGuiItemFlags_MixedValue = 1 << 12, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)
ImGuiItemFlags_NoWindowHoverableCheck = 1 << 13, // false // Disable hoverable check in ItemHoverable() ImGuiItemFlags_NoWindowHoverableCheck = 1 << 13, // false // Disable hoverable check in ItemHoverable()
@ -1278,6 +1278,7 @@ struct ImGuiTreeNodeStackData
ImRect NavRect; // Used for nav landing ImRect NavRect; // Used for nav landing
}; };
// sizeof() = 18
struct IMGUI_API ImGuiStackSizes struct IMGUI_API ImGuiStackSizes
{ {
short SizeOfIDStack; short SizeOfIDStack;
@ -2463,8 +2464,8 @@ struct ImGuiContext
ImGuiComboPreviewData ComboPreviewData; ImGuiComboPreviewData ComboPreviewData;
ImRect WindowResizeBorderExpectedRect; // Expected border rect, switch to relative edit if moving ImRect WindowResizeBorderExpectedRect; // Expected border rect, switch to relative edit if moving
bool WindowResizeRelativeMode; bool WindowResizeRelativeMode;
short ScrollbarSeekMode; // 0: relative, -1/+1: prev/next page. short ScrollbarSeekMode; // 0: scroll to clicked location, -1/+1: prev/next page.
float ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage? float ScrollbarClickDeltaToGrabCenter; // When scrolling to mouse location: distance between mouse and center of grab box, normalized in parent space.
float SliderGrabClickOffset; float SliderGrabClickOffset;
float SliderCurrentAccum; // Accumulated slider delta when using navigation controls. float SliderCurrentAccum; // Accumulated slider delta when using navigation controls.
bool SliderCurrentAccumDirty; // Has the accumulated slider delta changed since last time we tried to apply it? bool SliderCurrentAccumDirty; // Has the accumulated slider delta changed since last time we tried to apply it?
@ -3918,11 +3919,14 @@ namespace ImGui
IMGUI_API void GcCompactTransientWindowBuffers(ImGuiWindow* window); IMGUI_API void GcCompactTransientWindowBuffers(ImGuiWindow* window);
IMGUI_API void GcAwakeTransientWindowBuffers(ImGuiWindow* window); IMGUI_API void GcAwakeTransientWindowBuffers(ImGuiWindow* window);
// Debug Tools // Error Checking, State Recovery
IMGUI_API void DebugAllocHook(ImGuiDebugAllocInfo* info, int frame_count, void* ptr, size_t size); // size >= 0 : alloc, size = -1 : free IMGUI_API void ErrorLogCallbackToDebugLog(void* user_data, const char* fmt, ...);
IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL); IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
IMGUI_API void ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL); IMGUI_API void ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
IMGUI_API void ErrorCheckUsingSetCursorPosToExtendParentBoundaries(); IMGUI_API void ErrorCheckUsingSetCursorPosToExtendParentBoundaries();
// Debug Tools
IMGUI_API void DebugAllocHook(ImGuiDebugAllocInfo* info, int frame_count, void* ptr, size_t size); // size >= 0 : alloc, size = -1 : free
IMGUI_API void DebugDrawCursorPos(ImU32 col = IM_COL32(255, 0, 0, 255)); IMGUI_API void DebugDrawCursorPos(ImU32 col = IM_COL32(255, 0, 0, 255));
IMGUI_API void DebugDrawLineExtents(ImU32 col = IM_COL32(255, 0, 0, 255)); IMGUI_API void DebugDrawLineExtents(ImU32 col = IM_COL32(255, 0, 0, 255));
IMGUI_API void DebugDrawItemRect(ImU32 col = IM_COL32(255, 0, 0, 255)); IMGUI_API void DebugDrawItemRect(ImU32 col = IM_COL32(255, 0, 0, 255));

View File

@ -1,4 +1,4 @@
// dear imgui, v1.91.2 // dear imgui, v1.91.3 WIP
// (tables and columns code) // (tables and columns code)
/* /*

View File

@ -1,4 +1,4 @@
// dear imgui, v1.91.2 // dear imgui, v1.91.3 WIP
// (widgets code) // (widgets code)
/* /*
@ -1005,9 +1005,10 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6
const int held_dir = (clicked_v_norm < grab_v_norm) ? -1 : (clicked_v_norm > grab_v_norm + grab_h_norm) ? +1 : 0; const int held_dir = (clicked_v_norm < grab_v_norm) ? -1 : (clicked_v_norm > grab_v_norm + grab_h_norm) ? +1 : 0;
if (g.ActiveIdIsJustActivated) if (g.ActiveIdIsJustActivated)
{ {
// On initial click calculate the distance between mouse and the center of the grab // On initial click when held_dir == 0 (clicked over grab): calculate the distance between mouse and the center of the grab
g.ScrollbarSeekMode = (short)held_dir; const bool scroll_to_clicked_location = (g.IO.ConfigScrollbarScrollByPage == false || g.IO.KeyShift || held_dir == 0);
g.ScrollbarClickDeltaToGrabCenter = (g.ScrollbarSeekMode == 0.0f) ? clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f : 0.0f; g.ScrollbarSeekMode = scroll_to_clicked_location ? 0 : (short)held_dir;
g.ScrollbarClickDeltaToGrabCenter = (held_dir == 0 && !g.IO.KeyShift) ? clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f : 0.0f;
} }
// Apply scroll (p_scroll_v will generally point on one member of window->Scroll) // Apply scroll (p_scroll_v will generally point on one member of window->Scroll)