diff --git a/backends/roblox/imgui_impl_roblox.lua b/backends/roblox/imgui_impl_roblox.lua index 11ff931..0cb75e8 100644 --- a/backends/roblox/imgui_impl_roblox.lua +++ b/backends/roblox/imgui_impl_roblox.lua @@ -217,8 +217,16 @@ function ImGui_ImplRoblox_Init(parent, render_scale) BackendData.HeartbeatCount += 1 end) - connect(UserInputService.WindowFocused, function() ImGui.GetIO():AddFocusEvent(true) end) - connect(UserInputService.WindowFocusReleased, function() ImGui.GetIO():AddFocusEvent(false) end) + -- (losing focus clears imgui's mouse to "unavailable"; NewFrame only resends a moved mouse, so on return forget the + -- last position: a click on a field without moving the mouse first would otherwise land nowhere) + connect(UserInputService.WindowFocused, function() + ImGui.GetIO():AddFocusEvent(true) + BackendData.MouseX, BackendData.MouseY = nil, nil + end) + connect(UserInputService.WindowFocusReleased, function() + ImGui.GetIO():AddFocusEvent(false) + BackendData.MouseX, BackendData.MouseY = nil, nil + end) end -- Text proxy (opt-in): a hidden TextBox holds focus while a text field is active (OS typing, paste, copy/cut) diff --git a/build/ImGui.linemap.json b/build/ImGui.linemap.json index 7abc275..dc9fc6b 100644 --- a/build/ImGui.linemap.json +++ b/build/ImGui.linemap.json @@ -1 +1 @@ -[[57, "imgui.lua"], [22812, "imgui_demo.lua"], [34672, "imgui_draw.lua"], [43097, "imgui_h.lua"], [46107, "roblox/raster.lua"], [47714, "roblox/textures.lua"], [47965, "roblox/layers.lua"], [48387, "roblox/overlays.lua"], [48468, "roblox/render.lua"], [49763, "roblox/parallel.lua"], [50295, "roblox/patches.lua"], [50580, "imgui_impl_roblox.lua"], [51084, "imgui_impl_roblox_fonts.lua"], [57489, "imgui_internal.lua"], [61474, "imgui_tables.lua"], [66602, "imgui_widgets.lua"], [78990, "imstb_rectpack.lua"], [79667, "imstb_textedit.lua"], [81209, "imstb_truetype.lua"], [84143, "imstd_minstdio.lua"]] \ No newline at end of file +[[57, "imgui.lua"], [22812, "imgui_demo.lua"], [34672, "imgui_draw.lua"], [43097, "imgui_h.lua"], [46107, "roblox/raster.lua"], [47714, "roblox/textures.lua"], [47965, "roblox/layers.lua"], [48387, "roblox/overlays.lua"], [48468, "roblox/render.lua"], [49763, "roblox/parallel.lua"], [50295, "roblox/patches.lua"], [50580, "imgui_impl_roblox.lua"], [51092, "imgui_impl_roblox_fonts.lua"], [57497, "imgui_internal.lua"], [61482, "imgui_tables.lua"], [66610, "imgui_widgets.lua"], [78998, "imstb_rectpack.lua"], [79675, "imstb_textedit.lua"], [81217, "imstb_truetype.lua"], [84151, "imstd_minstdio.lua"]] \ No newline at end of file diff --git a/build/ImGui.luau b/build/ImGui.luau index e88c05c..4800965 100644 --- a/build/ImGui.luau +++ b/build/ImGui.luau @@ -50796,8 +50796,16 @@ function ImGui_ImplRoblox_Init(parent, render_scale) BackendData.HeartbeatCount += 1 end) - connect(UserInputService.WindowFocused, function() ImGui.GetIO():AddFocusEvent(true) end) - connect(UserInputService.WindowFocusReleased, function() ImGui.GetIO():AddFocusEvent(false) end) + -- (losing focus clears imgui's mouse to "unavailable"; NewFrame only resends a moved mouse, so on return forget the + -- last position: a click on a field without moving the mouse first would otherwise land nowhere) + connect(UserInputService.WindowFocused, function() + ImGui.GetIO():AddFocusEvent(true) + BackendData.MouseX, BackendData.MouseY = nil, nil + end) + connect(UserInputService.WindowFocusReleased, function() + ImGui.GetIO():AddFocusEvent(false) + BackendData.MouseX, BackendData.MouseY = nil, nil + end) end -- Text proxy (opt-in): a hidden TextBox holds focus while a text field is active (OS typing, paste, copy/cut)