|
@@ -639,6 +639,7 @@ static bool IsKeyPressedMap(ImGuiKey key, bool repeat = true);
|
|
static ImFont* GetDefaultFont();
|
|
static ImFont* GetDefaultFont();
|
|
static void SetCurrentFont(ImFont* font);
|
|
static void SetCurrentFont(ImFont* font);
|
|
static void SetCurrentWindow(ImGuiWindow* window);
|
|
static void SetCurrentWindow(ImGuiWindow* window);
|
|
|
|
+static void SetWindowScrollX(ImGuiWindow* window, float new_scroll_x);
|
|
static void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y);
|
|
static void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y);
|
|
static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond);
|
|
static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond);
|
|
static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond);
|
|
static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond);
|
|
@@ -2516,6 +2517,16 @@ void ImGui::NewFrame()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // Horizontal wheel scrolling; for consistency, only allowed if Ctrl is not pressed.
|
|
|
|
+ if (g.HoveredWindow && g.IO.MouseHorizWheel != 0.0f && !g.HoveredWindow->Collapsed)
|
|
|
|
+ {
|
|
|
|
+ ImGuiWindow* window = g.HoveredWindow;
|
|
|
|
+ if (!g.IO.KeyCtrl && !(window->Flags & ImGuiWindowFlags_NoScrollWithMouse))
|
|
|
|
+ {
|
|
|
|
+ SetWindowScrollX(window, window->Scroll.x - g.IO.MouseHorizWheel * 10.f);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// Pressing TAB activate widget focus
|
|
// Pressing TAB activate widget focus
|
|
if (g.ActiveId == 0 && g.NavWindow != NULL && g.NavWindow->Active && IsKeyPressedMap(ImGuiKey_Tab, false))
|
|
if (g.ActiveId == 0 && g.NavWindow != NULL && g.NavWindow->Active && IsKeyPressedMap(ImGuiKey_Tab, false))
|
|
g.NavWindow->FocusIdxTabRequestNext = 0;
|
|
g.NavWindow->FocusIdxTabRequestNext = 0;
|
|
@@ -5609,6 +5620,13 @@ ImVec2 ImGui::GetWindowPos()
|
|
return window->Pos;
|
|
return window->Pos;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void SetWindowScrollX(ImGuiWindow* window, float new_scroll_x)
|
|
|
|
+{
|
|
|
|
+ window->DC.CursorMaxPos.x += window->Scroll.x; // SizeContents is generally computed based on CursorMaxPos which is affected by scroll position, so we need to apply our change to it.
|
|
|
|
+ window->Scroll.x = new_scroll_x;
|
|
|
|
+ window->DC.CursorMaxPos.x -= window->Scroll.x;
|
|
|
|
+}
|
|
|
|
+
|
|
static void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y)
|
|
static void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y)
|
|
{
|
|
{
|
|
window->DC.CursorMaxPos.y += window->Scroll.y; // SizeContents is generally computed based on CursorMaxPos which is affected by scroll position, so we need to apply our change to it.
|
|
window->DC.CursorMaxPos.y += window->Scroll.y; // SizeContents is generally computed based on CursorMaxPos which is affected by scroll position, so we need to apply our change to it.
|