diff --git a/build/ImGui.luau b/build/ImGui.luau index cbaefbd..ca4c1b7 100644 --- a/build/ImGui.luau +++ b/build/ImGui.luau @@ -7387,7 +7387,10 @@ local function FindHoveredWindowEx(pos, find_first_and_in_any_viewport) end if window.HitTestHoleSize.x ~= 0 then - -- TODO: hit test hole + local hx, hy = window.Pos.x + window.HitTestHoleOffset.x, window.Pos.y + window.HitTestHoleOffset.y + if pos.x >= hx and pos.y >= hy and pos.x < hx + window.HitTestHoleSize.x and pos.y < hy + window.HitTestHoleSize.y then + break -- continue + end end if find_first_and_in_any_viewport then diff --git a/imgui/imgui.lua b/imgui/imgui.lua index 6b7d0ef..b67b30d 100644 --- a/imgui/imgui.lua +++ b/imgui/imgui.lua @@ -7376,7 +7376,10 @@ local function FindHoveredWindowEx(pos, find_first_and_in_any_viewport) end if window.HitTestHoleSize.x ~= 0 then - -- TODO: hit test hole + local hx, hy = window.Pos.x + window.HitTestHoleOffset.x, window.Pos.y + window.HitTestHoleOffset.y + if pos.x >= hx and pos.y >= hy and pos.x < hx + window.HitTestHoleSize.x and pos.y < hy + window.HitTestHoleSize.y then + break -- continue + end end if find_first_and_in_any_viewport then diff --git a/tools/test/scripts/t_passthru.luau b/tools/test/scripts/t_passthru.luau new file mode 100644 index 0000000..641f71a --- /dev/null +++ b/tools/test/scripts/t_passthru.luau @@ -0,0 +1,23 @@ +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local G = require(ReplicatedStorage:WaitForChild("ImGui")) +local ImGui, ImVec2 = G.ImGui, G.ImVec2 +ImGui.CreateContext() +local io = ImGui.GetIO() +io.ConfigFlags = bit32.bor(io.ConfigFlags, G.ImGuiConfigFlags.DockingEnable) +G.ImGui_ImplRoblox.Init() +local frame = 0 +RunService.Stepped:Connect(function() + frame += 1 + G.ImGui_ImplRoblox.NewFrame() + if frame == 5 then io:AddMousePosEvent(io.DisplaySize.x * 0.5, io.DisplaySize.y * 0.5) end + if frame == 10 then io:AddMousePosEvent(60, 60) end + ImGui.NewFrame() + ImGui.DockSpaceOverViewport(0, nil, G.ImGuiDockNodeFlags.PassthruCentralNode) + ImGui.SetNextWindowPos(ImVec2(20, 20)); ImGui.SetNextWindowSize(ImVec2(200, 200)) + ImGui.Begin("W"); ImGui.Text("hi"); ImGui.End() + ImGui.Render() + if frame == 8 then assert(not io.WantCaptureMouse, "central node must not capture") end + if frame == 13 then assert(io.WantCaptureMouse, "window must capture"); print("PASSTHRU OK") end + G.ImGui_ImplRoblox.RenderDrawData(ImGui.GetDrawData()) +end)