mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Using the ImGuiWindowFlags_NoScrollWithMouse flag on a child window forwards the mouse wheel event to the parent window, unless either ImGuiWindowFlags_NoInputs or ImGuiWindowFlags_NoScrollbar are also set. (#1380, #1502)
This commit is contained in:
@ -997,6 +997,9 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
{
|
||||
if (ImGui::TreeNode("Child regions"))
|
||||
{
|
||||
static bool disable_mouse_wheel = false;
|
||||
ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel);
|
||||
|
||||
ImGui::Text("Without border");
|
||||
static int line = 50;
|
||||
bool goto_line = ImGui::Button("Goto");
|
||||
@ -1004,7 +1007,8 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
ImGui::PushItemWidth(100);
|
||||
goto_line |= ImGui::InputInt("##Line", &line, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue);
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::BeginChild("Sub1", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f,300), false, ImGuiWindowFlags_HorizontalScrollbar);
|
||||
|
||||
ImGui::BeginChild("Sub1", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f,300), false, ImGuiWindowFlags_HorizontalScrollbar | (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0));
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
ImGui::Text("%04d: scrollable region", i);
|
||||
@ -1018,7 +1022,7 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
|
||||
ImGui::BeginChild("Sub2", ImVec2(0,300), true);
|
||||
ImGui::BeginChild("Sub2", ImVec2(0,300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0));
|
||||
ImGui::Text("With border");
|
||||
ImGui::Columns(2);
|
||||
for (int i = 0; i < 100; i++)
|
||||
|
Reference in New Issue
Block a user