mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
Fix 2 buttons can be highlighted at the same time in simple-button module
This commit is contained in:
@@ -265,7 +265,16 @@ end
|
||||
---@param x number # Mouse position
|
||||
---@param y number # Mouse position
|
||||
function BUTTON.checkHovering(list, x, y)
|
||||
for _, v in pairs(list) do v._hovering = v:isHovering(x, y) end
|
||||
local highlighted_a_button = false
|
||||
for _, v in pairs(list) do
|
||||
if highlighted_a_button then
|
||||
v._hovering = false
|
||||
else
|
||||
v._hovering = v:isHovering(x, y)
|
||||
end
|
||||
|
||||
if not highlighted_a_button and v._hovering then highlighted_a_button = true end
|
||||
end
|
||||
end
|
||||
|
||||
--- Trigger the press action, only if ``button._hovering == true``
|
||||
|
||||
Reference in New Issue
Block a user