Port window hit-test hole so PassthruCentralNode doesn't capture the mouse
This commit is contained in:
+4
-1
@@ -7387,7 +7387,10 @@ local function FindHoveredWindowEx(pos, find_first_and_in_any_viewport)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if window.HitTestHoleSize.x ~= 0 then
|
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
|
end
|
||||||
|
|
||||||
if find_first_and_in_any_viewport then
|
if find_first_and_in_any_viewport then
|
||||||
|
|||||||
+4
-1
@@ -7376,7 +7376,10 @@ local function FindHoveredWindowEx(pos, find_first_and_in_any_viewport)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if window.HitTestHoleSize.x ~= 0 then
|
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
|
end
|
||||||
|
|
||||||
if find_first_and_in_any_viewport then
|
if find_first_and_in_any_viewport then
|
||||||
|
|||||||
@@ -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)
|
||||||
Reference in New Issue
Block a user