Skip to content

Commit 7f317df

Browse files
TimMenu/Widgets: fixed the hover problem reacting widgets to mosue that wasnt over them but on popup above them
1 parent f2a8f61 commit 7f317df

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

TimMenu/Widgets/ColorPicker.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,14 @@ local function ColorPicker(win, label, initColor)
115115
local bounds = { x = absX, y = absY, w = width, h = height }
116116
local hovered, pressed, clicked = Interaction.Process(win, widgetKey, bounds, state.open)
117117

118+
-- Maintain popup blocked regions while open
119+
if state.open then
120+
win._widgetBlockedRegions = { popupBounds }
121+
end
122+
118123
-- Toggle popup on field click
119124
if clicked and hovered and not state.open then
120125
state.open = true
121-
win._widgetBlockedRegions = { popupBounds }
122126
-- Bring window to front
123127
for i, id in ipairs(TimMenuGlobal.order) do
124128
if id == win.id then

TimMenu/Widgets/Combo.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ local function Combo(win, label, selected, options)
101101
local listH = #options * height
102102
local popupBounds = { x = ctx.absX, y = ctx.absY + height, w = width, h = listH }
103103

104+
-- Maintain popup blocked regions while open
105+
if entry.open then
106+
win._widgetBlockedRegions = { popupBounds }
107+
end
108+
104109
-- Close popup on outside click using cached mouse position
105110
Interaction.ClosePopupOnOutsideClick(
106111
entry,
@@ -113,9 +118,8 @@ local function Combo(win, label, selected, options)
113118

114119
if clicked then
115120
if not entry.open and hovered then
116-
-- Open combo popup and block region
121+
-- Open combo popup
117122
entry.open = true
118-
win._widgetBlockedRegions = { popupBounds }
119123
-- Bring window to front
120124
for i, id in ipairs(TimMenuGlobal.order) do
121125
if id == win.id then

TimMenu/Widgets/Dropdown.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ local function Dropdown(win, label, selectedIndex, options)
8888
local listH = #options * height
8989
local popupBounds = { x = ctx.absX, y = ctx.absY + height, w = width, h = listH }
9090

91+
-- Maintain popup blocked regions while open
92+
if entry.open then
93+
win._widgetBlockedRegions = { popupBounds }
94+
end
95+
9196
-- Close popup on outside click using cached mouse position
9297
Interaction.ClosePopupOnOutsideClick(
9398
entry,
@@ -100,9 +105,8 @@ local function Dropdown(win, label, selectedIndex, options)
100105

101106
if clicked then
102107
if not entry.open and hovered then
103-
-- Open popup and block its region
108+
-- Open popup
104109
entry.open = true
105-
win._widgetBlockedRegions = { popupBounds }
106110
-- Bring this window to front so popup renders above all
107111
for i, id in ipairs(TimMenuGlobal.order) do
108112
if id == win.id then

0 commit comments

Comments
 (0)