@ -954,7 +954,7 @@ static const float NAV_WINDOWING_LIST_APPEAR_DELAY = 0.15f; // Time
// Window resizing from edges (when io.ConfigWindowsResizeFromEdges = true and ImGuiBackendFlags_HasMouseCursors is set in io.BackendFlags by backend)
static const float WINDOWS_HOVER_PADDING = 4.0f ; // Extend outside window for hovering/resizing (maxxed with TouchPadding) and inside windows for borders. Affect FindHoveredWindow().
static const float WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER = 0.04f ; // Reduce visual noise by only highlighting the border after a certain time.
static const float WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER = 0.8 0f ; // Lock scrolled window (so it doesn't pick child windows that are scrolling through) for a certain time, unless mouse moved.
static const float WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER = 0.7 0f ; // Lock scrolled window (so it doesn't pick child windows that are scrolling through) for a certain time, unless mouse moved.
//-------------------------------------------------------------------------
// [SECTION] FORWARD DECLARATIONS
@ -4338,10 +4338,13 @@ static void ImGui::UpdateMouseInputs()
}
}
static void LockWheelingWindow ( ImGuiWindow * window )
static void LockWheelingWindow ( ImGuiWindow * window , float wheel_amount )
{
ImGuiContext & g = * GImGui ;
g . WheelingWindowReleaseTimer = window ? WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER : 0.0f ;
if ( window )
g . WheelingWindowReleaseTimer = ImMin ( g . WheelingWindowReleaseTimer + ImAbs ( wheel_amount ) * WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER , WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER ) ;
else
g . WheelingWindowReleaseTimer = NULL ;
if ( g . WheelingWindow = = window )
return ;
IMGUI_DEBUG_LOG_IO ( " LockWheelingWindow() \" %s \" \n " , window ? window - > Name : " NULL " ) ;
@ -4360,7 +4363,7 @@ void ImGui::UpdateMouseWheel()
if ( IsMousePosValid ( ) & & ImLengthSqr ( g . IO . MousePos - g . WheelingWindowRefMousePos ) > g . IO . MouseDragThreshold * g . IO . MouseDragThreshold )
g . WheelingWindowReleaseTimer = 0.0f ;
if ( g . WheelingWindowReleaseTimer < = 0.0f )
LockWheelingWindow ( NULL ) ;
LockWheelingWindow ( NULL , 0.0f ) ;
}
ImVec2 wheel ;
@ -4378,7 +4381,7 @@ void ImGui::UpdateMouseWheel()
// FIXME-OBSOLETE: This is an old feature, it still works but pretty much nobody is using it and may be best redesigned.
if ( wheel . y ! = 0.0f & & g . IO . KeyCtrl & & g . IO . FontAllowUserScaling )
{
LockWheelingWindow ( mouse_window ) ;
LockWheelingWindow ( mouse_window , wheel . y ) ;
ImGuiWindow * window = mouse_window ;
const float new_font_scale = ImClamp ( window - > FontWindowScale + g . IO . MouseWheel * 0.10f , 0.50f , 2.50f ) ;
const float scale = new_font_scale / window - > FontWindowScale ;
@ -4417,7 +4420,7 @@ void ImGui::UpdateMouseWheel()
window = window - > ParentWindow ;
if ( ! ( window - > Flags & ImGuiWindowFlags_NoScrollWithMouse ) & & ! ( window - > Flags & ImGuiWindowFlags_NoMouseInputs ) )
{
LockWheelingWindow ( mouse_window ) ;
LockWheelingWindow ( mouse_window , wheel . y ) ;
float max_step = window - > InnerRect . GetHeight ( ) * 0.67f ;
float scroll_step = ImFloor ( ImMin ( 5 * window - > CalcFontSize ( ) , max_step ) ) ;
SetScrollY ( window , window - > Scroll . y - wheel . y * scroll_step ) ;
@ -4432,7 +4435,7 @@ void ImGui::UpdateMouseWheel()
window = window - > ParentWindow ;
if ( ! ( window - > Flags & ImGuiWindowFlags_NoScrollWithMouse ) & & ! ( window - > Flags & ImGuiWindowFlags_NoMouseInputs ) )
{
LockWheelingWindow ( mouse_window ) ;
LockWheelingWindow ( mouse_window , wheel . x ) ;
float max_step = window - > InnerRect . GetWidth ( ) * 0.67f ;
float scroll_step = ImFloor ( ImMin ( 2 * window - > CalcFontSize ( ) , max_step ) ) ;
SetScrollX ( window , window - > Scroll . x - wheel . x * scroll_step ) ;